home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: Tape Archive
(archive/tar).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| Tape Archive (archive/tar)
| magic
| Supported |
100%
| file
| POSIX tar archive (GNU)
| default
| |
99%
| file
| POSIX tar archive (GNU), file documentation/RLI-Cplusplus.html, mode 644 , uid 42107 , gid 3047 , size 57456 , seconds 6227256330, user carlos, group uastaff
| default
| |
98%
| file
| data
| default
| |
62%
| TrID
| TAR - Tape ARchive (GNU)
| default
| |
37%
| TrID
| TAR - Tape ARchive (file)
| default
| |
100%
| siegfried
| x-fmt/265 Tape Archive Format
| default
| |
100%
| lsar
| Tar
| default
| |
100%
| gt2
| TAR Archiv gefunden (Auflistung ist deaktiviert)
| default
| |
100%
| disktype
| GNU tar archive
| default
| |
100%
| detectItEasy
| Archive: tar
| default
| |
100%
| binwalkID
| POSIX tar archive (GNU), owner user name: "ation/RLI-Cplusplus.html"
| default
| |
100%
| xdgMime
| application/x-tar
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TARF] |
macFileCreator | [TAR ] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 64 6f 63 75 6d 65 6e 74 | 61 74 69 6f 6e 2f 52 4c |document|ation/RL|
|00000010| 49 2d 43 70 6c 75 73 70 | 6c 75 73 2e 68 74 6d 6c |I-Cplusp|lus.html|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000050| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000060| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 34 32 31 |.... 6|44 . 421|
|00000070| 30 37 20 00 20 20 33 30 | 34 37 20 00 20 20 20 20 |07 . 30|47 . |
|00000080| 20 20 35 37 34 35 36 20 | 20 36 32 32 37 32 35 36 | 57456 | 6227256|
|00000090| 33 33 30 20 20 31 36 34 | 36 31 00 20 30 00 00 00 |330 164|61. 0...|
|000000a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000100| 00 75 73 74 61 72 20 20 | 00 63 61 72 6c 6f 73 00 |.ustar |.carlos.|
|00000110| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000120| 00 00 00 00 00 00 00 00 | 00 75 61 73 74 61 66 66 |........|.uastaff|
|00000130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000180| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000190| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000200| 3c 48 54 4d 4c 3e 20 0a | 3c 48 45 41 44 3e 20 0a |<HTML> .|<HEAD> .|
|00000210| 0a 3c 54 49 54 4c 45 3e | 0a 41 20 53 74 61 6e 64 |.<TITLE>|.A Stand|
|00000220| 61 72 64 20 49 6e 74 65 | 72 66 61 63 65 20 66 6f |ard Inte|rface fo|
|00000230| 72 20 52 65 69 6e 66 6f | 72 63 65 6d 65 6e 74 20 |r Reinfo|rcement |
|00000240| 4c 65 61 72 6e 69 6e 67 | 20 53 6f 66 74 77 61 72 |Learning| Softwar|
|00000250| 65 20 69 6e 20 43 2b 2b | 20 0a 3c 2f 54 49 54 4c |e in C++| .</TITL|
|00000260| 45 3e 20 0a 0a 3c 21 2d | 2d 20 43 68 61 6e 67 65 |E> ..<!-|- Change|
|00000270| 64 20 62 79 3a 20 4a 75 | 61 6e 20 43 2e 20 53 61 |d by: Ju|an C. Sa|
|00000280| 6e 74 61 6d 61 72 69 61 | 2c 20 31 34 2d 41 75 67 |ntamaria|, 14-Aug|
|00000290| 2d 31 39 39 36 20 2d 2d | 3e 0a 3c 21 2d 2d 20 43 |-1996 --|>.<!-- C|
|000002a0| 68 61 6e 67 65 64 20 62 | 79 3a 20 52 69 63 68 20 |hanged b|y: Rich |
|000002b0| 53 75 74 74 6f 6e 2c 20 | 32 35 2d 41 75 67 2d 31 |Sutton, |25-Aug-1|
|000002c0| 39 39 36 20 2d 2d 3e 0a | 3c 21 2d 2d 20 43 68 61 |996 -->.|<!-- Cha|
|000002d0| 6e 67 65 64 20 62 79 3a | 20 4a 75 61 6e 20 43 2e |nged by:| Juan C.|
|000002e0| 20 53 61 6e 74 61 6d 61 | 72 69 61 2c 20 31 30 2d | Santama|ria, 10-|
|000002f0| 4f 63 74 2d 31 39 39 36 | 20 2d 2d 3e 0a 0a 3c 2f |Oct-1996| -->..</|
|00000300| 48 45 41 44 3e 0a 0a 3c | 42 4f 44 59 3e 0a 0a 3c |HEAD>..<|BODY>..<|
|00000310| 48 31 3e 0a 41 20 53 74 | 61 6e 64 61 72 64 20 49 |H1>.A St|andard I|
|00000320| 6e 74 65 72 66 61 63 65 | 20 66 6f 72 20 52 65 69 |nterface| for Rei|
|00000330| 6e 66 6f 72 63 65 6d 65 | 6e 74 20 4c 65 61 72 6e |nforceme|nt Learn|
|00000340| 69 6e 67 20 53 6f 66 74 | 77 61 72 65 20 69 6e 20 |ing Soft|ware in |
|00000350| 43 2b 2b 20 0a 3c 2f 48 | 31 3e 0a 0a 3c 48 33 3e |C++ .</H|1>..<H3>|
|00000360| 0a 56 65 72 73 69 6f 6e | 3a 20 31 2e 33 0a 3c 2f |.Version|: 1.3.</|
|00000370| 48 33 3e 0a 0a 3c 50 3e | 20 62 79 20 52 69 63 68 |H3>..<P>| by Rich|
|00000380| 61 72 64 20 53 2e 20 53 | 75 74 74 6f 6e 20 61 6e |ard S. S|utton an|
|00000390| 64 20 4a 75 61 6e 20 43 | 61 72 6c 6f 73 20 53 61 |d Juan C|arlos Sa|
|000003a0| 6e 74 61 6d 61 72 69 61 | 0a 0a 3c 55 4c 3e 0a 3c |ntamaria|..<UL>.<|
|000003b0| 4c 49 3e 3c 61 20 68 72 | 65 66 3d 22 23 49 6e 74 |LI><a hr|ef="#Int|
|000003c0| 72 6f 64 75 63 74 69 6f | 6e 22 3e 49 6e 74 72 6f |roductio|n">Intro|
|000003d0| 64 75 63 74 69 6f 6e 3c | 2f 61 3e 0a 3c 4c 49 3e |duction<|/a>.<LI>|
|000003e0| 3c 41 20 48 52 45 46 3d | 22 23 41 67 65 6e 74 22 |<A HREF=|"#Agent"|
|000003f0| 3e 41 67 65 6e 74 3c 2f | 41 3e 0a 20 20 20 20 3c |>Agent</|A>. <|
|00000400| 55 4c 3e 20 0a 20 20 20 | 20 3c 4c 49 3e 3c 41 20 |UL> . | <LI><A |
|00000410| 48 52 45 46 3d 22 23 41 | 67 65 6e 74 3a 3a 69 6e |HREF="#A|gent::in|
|00000420| 69 74 22 3e 41 67 65 6e | 74 3a 3a 69 6e 69 74 3c |it">Agen|t::init<|
|00000430| 2f 41 3e 0a 20 20 20 20 | 3c 4c 49 3e 3c 41 20 48 |/A>. |<LI><A H|
|00000440| 52 45 46 3d 22 23 41 67 | 65 6e 74 3a 3a 73 74 61 |REF="#Ag|ent::sta|
|00000450| 72 74 5f 74 72 69 61 6c | 22 3e 41 67 65 6e 74 3a |rt_trial|">Agent:|
|00000460| 3a 73 74 61 72 74 5f 74 | 72 69 61 6c 3c 2f 41 3e |:start_t|rial</A>|
|00000470| 0a 20 20 20 20 3c 4c 49 | 3e 3c 41 20 48 52 45 46 |. <LI|><A HREF|
|00000480| 3d 22 23 41 67 65 6e 74 | 3a 3a 73 74 65 70 22 3e |="#Agent|::step">|
|00000490| 41 67 65 6e 74 3a 3a 73 | 74 65 70 3c 2f 41 3e 0a |Agent::s|tep</A>.|
|000004a0| 20 20 20 20 3c 2f 55 4c | 3e 0a 3c 4c 49 3e 3c 41 | </UL|>.<LI><A|
|000004b0| 20 48 52 45 46 3d 22 23 | 45 6e 76 69 72 6f 6e 6d | HREF="#|Environm|
|000004c0| 65 6e 74 22 3e 45 6e 76 | 69 72 6f 6e 6d 65 6e 74 |ent">Env|ironment|
|000004d0| 3c 2f 41 3e 0a 20 20 20 | 20 3c 55 4c 3e 20 0a 20 |</A>. | <UL> . |
|000004e0| 20 20 20 3c 4c 49 3e 3c | 41 20 48 52 45 46 3d 22 | <LI><|A HREF="|
|000004f0| 23 45 6e 76 69 72 6f 6e | 6d 65 6e 74 3a 3a 69 6e |#Environ|ment::in|
|00000500| 69 74 22 3e 45 6e 76 69 | 72 6f 6e 6d 65 6e 74 3a |it">Envi|ronment:|
|00000510| 3a 69 6e 69 74 3c 2f 41 | 3e 0a 20 20 20 20 3c 4c |:init</A|>. <L|
|00000520| 49 3e 3c 41 20 48 52 45 | 46 3d 22 23 45 6e 76 69 |I><A HRE|F="#Envi|
|00000530| 72 6f 6e 6d 65 6e 74 3a | 3a 73 74 61 72 74 5f 74 |ronment:|:start_t|
|00000540| 72 69 61 6c 22 3e 45 6e | 76 69 72 6f 6e 6d 65 6e |rial">En|vironmen|
|00000550| 74 3a 3a 73 74 61 72 74 | 5f 74 72 69 61 6c 3c 2f |t::start|_trial</|
|00000560| 41 3e 0a 20 20 20 20 3c | 4c 49 3e 3c 41 20 48 52 |A>. <|LI><A HR|
|00000570| 45 46 3d 22 23 45 6e 76 | 69 72 6f 6e 6d 65 6e 74 |EF="#Env|ironment|
|00000580| 3a 3a 73 74 65 70 22 3e | 45 6e 76 69 72 6f 6e 6d |::step">|Environm|
|00000590| 65 6e 74 3a 3a 73 74 65 | 70 3c 2f 41 3e 0a 20 20 |ent::ste|p</A>. |
|000005a0| 20 20 3c 2f 55 4c 3e 0a | 3c 4c 49 3e 3c 41 20 48 | </UL>.|<LI><A H|
|000005b0| 52 45 46 3d 22 23 53 69 | 6d 75 6c 61 74 69 6f 6e |REF="#Si|mulation|
|000005c0| 22 3e 53 69 6d 75 6c 61 | 74 69 6f 6e 3c 2f 41 3e |">Simula|tion</A>|
|000005d0| 0a 20 20 20 20 3c 55 4c | 3e 20 0a 20 20 20 20 3c |. <UL|> . <|
|000005e0| 4c 49 3e 3c 41 20 48 52 | 45 46 3d 22 23 53 69 6d |LI><A HR|EF="#Sim|
|000005f0| 75 6c 61 74 69 6f 6e 3a | 3a 69 6e 69 74 22 3e 53 |ulation:|:init">S|
|00000600| 69 6d 75 6c 61 74 69 6f | 6e 3a 3a 69 6e 69 74 3c |imulatio|n::init<|
|00000610| 2f 41 3e 0a 20 20 20 20 | 3c 4c 49 3e 3c 41 20 48 |/A>. |<LI><A H|
|00000620| 52 45 46 3d 22 23 53 69 | 6d 75 6c 61 74 69 6f 6e |REF="#Si|mulation|
|00000630| 3a 3a 73 74 61 72 74 5f | 74 72 69 61 6c 22 3e 53 |::start_|trial">S|
|00000640| 69 6d 75 6c 61 74 69 6f | 6e 3a 3a 73 74 61 72 74 |imulatio|n::start|
|00000650| 5f 74 72 69 61 6c 3c 2f | 41 3e 0a 20 20 20 20 3c |_trial</|A>. <|
|00000660| 4c 49 3e 3c 41 20 48 52 | 45 46 3d 22 23 53 69 6d |LI><A HR|EF="#Sim|
|00000670| 75 6c 61 74 69 6f 6e 3a | 3a 73 74 65 70 73 22 3e |ulation:|:steps">|
|00000680| 53 69 6d 75 6c 61 74 69 | 6f 6e 3a 3a 73 74 65 70 |Simulati|on::step|
|00000690| 73 3c 2f 41 3e 0a 20 20 | 20 20 3c 4c 49 3e 3c 41 |s</A>. | <LI><A|
|000006a0| 20 48 52 45 46 3d 22 23 | 53 69 6d 75 6c 61 74 69 | HREF="#|Simulati|
|000006b0| 6f 6e 3a 3a 74 72 69 61 | 6c 73 22 3e 53 69 6d 75 |on::tria|ls">Simu|
|000006c0| 6c 61 74 69 6f 6e 3a 3a | 74 72 69 61 6c 73 3c 2f |lation::|trials</|
|000006d0| 41 3e 0a 20 20 20 20 3c | 4c 49 3e 3c 41 20 48 52 |A>. <|LI><A HR|
|000006e0| 45 46 3d 22 23 53 69 6d | 75 6c 61 74 69 6f 6e 3a |EF="#Sim|ulation:|
|000006f0| 3a 63 6f 6c 6c 65 63 74 | 5f 64 61 74 61 22 3e 53 |:collect|_data">S|
|00000700| 69 6d 75 6c 61 74 69 6f | 6e 3a 3a 63 6f 6c 6c 65 |imulatio|n::colle|
|00000710| 63 74 5f 64 61 74 61 3c | 2f 41 3e 0a 20 20 20 20 |ct_data<|/A>. |
|00000720| 3c 2f 55 4c 3e 0a 3c 4c | 49 3e 3c 41 20 48 52 45 |</UL>.<L|I><A HRE|
|00000730| 46 3d 22 23 63 72 6f 73 | 73 2d 72 65 66 65 72 65 |F="#cros|s-refere|
|00000740| 6e 63 65 22 3e 41 63 63 | 65 73 73 69 6e 67 20 6f |nce">Acc|essing o|
|00000750| 6e 65 20 6f 62 6a 65 63 | 74 20 66 72 6f 6d 20 61 |ne objec|t from a|
|00000760| 6e 6f 74 68 65 72 3c 2f | 41 3e 0a 3c 4c 49 3e 3c |nother</|A>.<LI><|
|00000770| 41 20 48 52 45 46 3d 22 | 23 64 6f 75 62 6c 65 2d |A HREF="|#double-|
|00000780| 69 6e 74 65 67 72 61 74 | 6f 72 22 3e 41 20 63 6f |integrat|or">A co|
|00000790| 6d 70 6c 65 74 65 20 65 | 78 61 6d 70 6c 65 3a 20 |mplete e|xample: |
|000007a0| 43 4d 41 43 20 61 6e 64 | 20 64 6f 75 62 6c 65 2d |CMAC and| double-|
|000007b0| 69 6e 74 65 67 72 61 74 | 6f 72 3c 2f 41 3e 0a 3c |integrat|or</A>.<|
|000007c0| 2f 55 4c 3e 0a 0a 3c 68 | 72 3e 0a 0a 3c 61 20 4e |/UL>..<h|r>..<a N|
|000007d0| 41 4d 45 3d 22 49 6e 74 | 72 6f 64 75 63 74 69 6f |AME="Int|roductio|
|000007e0| 6e 22 3e 3c 2f 61 3e 20 | 0a 3c 68 32 3e 20 49 6e |n"></a> |.<h2> In|
|000007f0| 74 72 6f 64 75 63 74 69 | 6f 6e 20 3c 2f 68 32 3e |troducti|on </h2>|
|00000800| 3c 2f 61 3e 0a 0a 3c 50 | 3e 20 54 68 69 73 20 64 |</a>..<P|> This d|
|00000810| 6f 63 75 6d 65 6e 74 20 | 70 72 65 73 65 6e 74 73 |ocument |presents|
|00000820| 20 61 20 3c 41 0a 48 52 | 45 46 3d 22 68 74 74 70 | a <A.HR|EF="http|
|00000830| 3a 2f 2f 65 6e 76 79 2e | 63 73 2e 75 6d 61 73 73 |://envy.|cs.umass|
|00000840| 2e 65 64 75 2f 50 65 6f | 70 6c 65 2f 73 75 74 74 |.edu/Peo|ple/sutt|
|00000850| 6f 6e 2f 52 4c 69 6e 74 | 65 72 66 61 63 65 2f 52 |on/RLint|erface/R|
|00000860| 4c 69 6e 74 65 72 66 61 | 63 65 2e 68 74 6d 6c 22 |Linterfa|ce.html"|
|00000870| 3e 73 74 61 6e 64 61 72 | 64 0a 69 6e 74 65 72 66 |>standar|d.interf|
|00000880| 61 63 65 20 66 6f 72 20 | 70 72 6f 67 72 61 6d 6d |ace for |programm|
|00000890| 69 6e 67 20 72 65 69 6e | 66 6f 72 63 65 6d 65 6e |ing rein|forcemen|
|000008a0| 74 20 6c 65 61 72 6e 69 | 6e 67 20 73 69 6d 75 6c |t learni|ng simul|
|000008b0| 61 74 69 6f 6e 73 3c 2f | 41 3e 20 69 6e 0a 3c 42 |ations</|A> in.<B|
|000008c0| 3e 43 2b 2b 3c 2f 42 3e | 2e 20 20 54 68 65 72 65 |>C++</B>|. There|
|000008d0| 20 61 72 65 20 74 68 72 | 65 65 20 62 61 73 69 63 | are thr|ee basic|
|000008e0| 20 6f 62 6a 65 63 74 73 | 3a 20 61 67 65 6e 74 73 | objects|: agents|
|000008f0| 2c 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 73 2c 20 |, enviro|nments, |
|00000900| 61 6e 64 0a 73 69 6d 75 | 6c 61 74 69 6f 6e 73 2e |and.simu|lations.|
|00000910| 20 20 54 68 65 20 61 67 | 65 6e 74 20 69 73 20 74 | The ag|ent is t|
|00000920| 68 65 20 6c 65 61 72 6e | 69 6e 67 20 61 67 65 6e |he learn|ing agen|
|00000930| 74 20 61 6e 64 20 74 68 | 65 20 65 6e 76 69 72 6f |t and th|e enviro|
|00000940| 6e 6d 65 6e 74 20 69 73 | 0a 74 68 65 20 74 61 73 |nment is|.the tas|
|00000950| 6b 20 74 68 61 74 20 69 | 74 20 69 6e 74 65 72 61 |k that i|t intera|
|00000960| 63 74 73 20 77 69 74 68 | 2e 20 20 54 68 65 20 73 |cts with|. The s|
|00000970| 69 6d 75 6c 61 74 69 6f | 6e 20 6d 61 6e 61 67 65 |imulatio|n manage|
|00000980| 73 20 74 68 65 0a 69 6e | 74 65 72 61 63 74 69 6f |s the.in|teractio|
|00000990| 6e 20 62 65 74 77 65 65 | 6e 20 74 68 65 20 61 67 |n betwee|n the ag|
|000009a0| 65 6e 74 20 61 6e 64 20 | 74 68 65 20 65 6e 76 69 |ent and |the envi|
|000009b0| 72 6f 6e 6d 65 6e 74 2c | 20 63 6f 6c 6c 65 63 74 |ronment,| collect|
|000009c0| 73 20 64 61 74 61 2c 20 | 61 6e 64 0a 6d 61 6e 61 |s data, |and.mana|
|000009d0| 67 65 73 20 74 68 65 20 | 64 69 73 70 6c 61 79 2c |ges the |display,|
|000009e0| 20 69 66 20 61 6e 79 2e | 0a 0a 3c 50 3e 20 54 68 | if any.|..<P> Th|
|000009f0| 65 20 6f 75 74 70 75 74 | 73 20 6f 66 20 74 68 65 |e output|s of the|
|00000a00| 20 61 67 65 6e 74 20 61 | 72 65 20 74 65 72 6d 65 | agent a|re terme|
|00000a10| 64 20 3c 41 0a 4e 41 4d | 45 3d 22 41 63 74 69 6f |d <A.NAM|E="Actio|
|00000a20| 6e 22 3e 3c 65 6d 3e 61 | 63 74 69 6f 6e 73 3c 2f |n"><em>a|ctions</|
|00000a30| 65 6d 3e 3c 2f 41 3e 2c | 20 61 6e 64 20 74 68 65 |em></A>,| and the|
|00000a40| 20 69 6e 70 75 74 73 20 | 6f 66 20 74 68 65 20 61 | inputs |of the a|
|00000a50| 67 65 6e 74 20 61 72 65 | 0a 74 65 72 6d 65 64 20 |gent are|.termed |
|00000a60| 3c 41 20 4e 41 4d 45 3d | 22 53 65 6e 73 61 74 69 |<A NAME=|"Sensati|
|00000a70| 6f 6e 22 3e 3c 65 6d 3e | 73 65 6e 73 61 74 69 6f |on"><em>|sensatio|
|00000a80| 6e 73 3c 2f 65 6d 3e 3c | 2f 41 3e 2e 20 20 49 6e |ns</em><|/A>. In|
|00000a90| 20 74 68 65 20 73 69 6d | 70 6c 65 73 74 0a 63 61 | the sim|plest.ca|
|00000aa0| 73 65 2c 20 74 68 65 20 | 73 65 6e 73 61 74 69 6f |se, the |sensatio|
|00000ab0| 6e 73 20 61 72 65 20 74 | 68 65 20 73 74 61 74 65 |ns are t|he state|
|00000ac0| 73 20 6f 66 20 74 68 65 | 20 65 6e 76 69 72 6f 6e |s of the| environ|
|00000ad0| 6d 65 6e 74 2c 20 62 75 | 74 20 74 68 65 0a 69 6e |ment, bu|t the.in|
|00000ae0| 74 65 72 66 61 63 65 20 | 61 6c 6c 6f 77 73 20 74 |terface |allows t|
|00000af0| 68 65 6d 20 74 6f 20 62 | 65 20 61 72 62 69 74 72 |hem to b|e arbitr|
|00000b00| 61 69 6c 79 20 72 65 6c | 61 74 65 64 20 74 6f 20 |aily rel|ated to |
|00000b10| 74 68 65 20 74 72 75 65 | 20 73 74 61 74 65 73 20 |the true| states |
|00000b20| 6f 66 0a 74 68 65 20 65 | 6e 76 69 72 6f 6e 6d 65 |of.the e|nvironme|
|00000b30| 6e 74 2e 20 20 48 65 72 | 65 27 73 20 74 68 65 20 |nt. Her|e's the |
|00000b40| 73 74 61 6e 64 61 72 64 | 20 66 69 67 75 72 65 3a |standard| figure:|
|00000b50| 0a 0a 3c 50 3e 3c 43 45 | 4e 54 45 52 3e 3c 69 6d |..<P><CE|NTER><im|
|00000b60| 67 20 73 72 63 3d 22 52 | 4c 69 6e 74 65 72 61 63 |g src="R|Linterac|
|00000b70| 74 69 6f 6e 2e 47 49 46 | 22 3e 3c 2f 43 45 4e 54 |tion.GIF|"></CENT|
|00000b80| 45 52 3e 0a 0a 3c 50 3e | 20 57 68 65 72 65 61 73 |ER>..<P>| Whereas|
|00000b90| 20 74 68 65 20 72 65 77 | 61 72 64 20 69 73 20 61 | the rew|ard is a|
|00000ba0| 20 6e 75 6d 62 65 72 2c | 20 74 68 65 20 61 63 74 | number,| the act|
|00000bb0| 69 6f 6e 73 20 61 6e 64 | 20 73 65 6e 73 61 74 69 |ions and| sensati|
|00000bc0| 6f 6e 73 20 61 72 65 0a | 69 6e 73 74 61 6e 63 65 |ons are.|instance|
|00000bd0| 73 20 6f 66 20 63 6c 61 | 73 73 65 73 20 64 65 72 |s of cla|sses der|
|00000be0| 69 76 65 64 20 66 72 6f | 6d 20 74 68 65 20 3c 43 |ived fro|m the <C|
|00000bf0| 4f 44 45 3e 41 63 74 69 | 6f 6e 3c 2f 43 4f 44 45 |ODE>Acti|on</CODE|
|00000c00| 3e 20 61 6e 64 0a 3c 43 | 4f 44 45 3e 53 65 6e 73 |> and.<C|ODE>Sens|
|00000c10| 61 74 69 6f 6e 3c 2f 43 | 4f 44 45 3e 20 61 62 73 |ation</C|ODE> abs|
|00000c20| 74 72 61 63 74 20 63 6c | 61 73 73 65 73 20 72 65 |tract cl|asses re|
|00000c30| 73 70 65 63 74 69 76 65 | 6c 79 2e 20 54 68 65 0a |spective|ly. The.|
|00000c40| 69 6d 70 6c 65 6d 65 6e | 74 61 74 69 6f 6e 20 6f |implemen|tation o|
|00000c50| 66 20 61 63 74 69 6f 6e | 73 20 61 6e 64 20 73 65 |f action|s and se|
|00000c60| 6e 73 61 74 69 6f 6e 20 | 63 61 6e 20 62 65 20 61 |nsation |can be a|
|00000c70| 72 62 69 74 72 61 72 79 | 20 61 73 20 6c 6f 6e 67 |rbitrary| as long|
|00000c80| 20 61 73 0a 74 68 65 79 | 20 61 72 65 20 75 6e 64 | as.they| are und|
|00000c90| 65 72 73 74 6f 6f 64 20 | 70 72 6f 70 65 72 6c 79 |erstood |properly|
|00000ca0| 20 62 79 20 74 68 65 20 | 61 67 65 6e 74 20 61 6e | by the |agent an|
|00000cb0| 64 20 74 68 65 20 65 6e | 76 69 72 6f 6e 6d 65 6e |d the en|vironmen|
|00000cc0| 74 2e 0a 4f 62 76 69 6f | 75 73 6c 79 20 74 68 65 |t..Obvio|usly the|
|00000cd0| 20 61 67 65 6e 74 20 61 | 6e 64 20 65 6e 76 69 72 | agent a|nd envir|
|00000ce0| 6f 6e 6d 65 6e 74 20 68 | 61 76 65 20 74 6f 20 62 |onment h|ave to b|
|00000cf0| 65 20 63 68 6f 73 65 6e | 20 74 6f 20 62 65 20 63 |e chosen| to be c|
|00000d00| 6f 6d 70 61 74 69 62 6c | 65 0a 77 69 74 68 20 65 |ompatibl|e.with e|
|00000d10| 61 63 68 20 6f 74 68 65 | 72 20 69 6e 20 74 68 69 |ach othe|r in thi|
|00000d20| 73 20 77 61 79 2e 0a 0a | 3c 50 3e 20 54 68 65 20 |s way...|<P> The |
|00000d30| 69 6e 74 65 72 61 63 74 | 69 6f 6e 20 62 65 74 77 |interact|ion betw|
|00000d40| 65 65 6e 20 74 68 65 20 | 61 67 65 6e 74 20 61 6e |een the |agent an|
|00000d50| 64 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 20 69 73 |d enviro|nment is|
|00000d60| 20 68 61 6e 64 6c 65 64 | 20 69 6e 0a 64 69 73 63 | handled| in.disc|
|00000d70| 72 65 74 65 20 74 69 6d | 65 2e 20 20 57 65 20 61 |rete tim|e. We a|
|00000d80| 73 73 75 6d 65 20 77 65 | 20 61 72 65 20 77 6f 72 |ssume we| are wor|
|00000d90| 6b 69 6e 67 20 77 69 74 | 68 20 73 69 6d 75 6c 61 |king wit|h simula|
|00000da0| 74 69 6f 6e 73 20 68 65 | 72 65 3b 20 74 68 65 72 |tions he|re; ther|
|00000db0| 65 0a 61 72 65 20 6e 6f | 20 72 65 61 6c 2d 74 69 |e.are no| real-ti|
|00000dc0| 6d 65 20 63 6f 6e 73 74 | 72 61 69 6e 74 73 20 65 |me const|raints e|
|00000dd0| 6e 66 6f 72 63 65 64 20 | 62 79 20 74 68 65 20 69 |nforced |by the i|
|00000de0| 6e 74 65 72 66 61 63 65 | 2e 20 20 49 6e 20 6f 74 |nterface|. In ot|
|00000df0| 68 65 72 0a 77 6f 72 64 | 73 2c 20 74 68 65 20 65 |her.word|s, the e|
|00000e00| 6e 76 69 72 6f 6e 6d 65 | 6e 74 20 77 61 69 74 73 |nvironme|nt waits|
|00000e10| 20 66 6f 72 20 74 68 65 | 20 61 67 65 6e 74 20 77 | for the| agent w|
|00000e20| 68 69 6c 65 20 74 68 65 | 20 61 67 65 6e 74 20 69 |hile the| agent i|
|00000e30| 73 0a 73 65 6c 65 63 74 | 69 6e 67 20 69 74 73 20 |s.select|ing its |
|00000e40| 61 63 74 69 6f 6e 20 61 | 6e 64 20 74 68 65 20 61 |action a|nd the a|
|00000e50| 67 65 6e 74 20 77 61 69 | 74 73 20 66 6f 72 20 74 |gent wai|ts for t|
|00000e60| 68 65 20 65 6e 76 69 72 | 6f 6e 6d 65 6e 74 20 77 |he envir|onment w|
|00000e70| 68 69 6c 65 20 74 68 65 | 0a 65 6e 76 69 72 6f 6e |hile the|.environ|
|00000e80| 6d 65 6e 74 20 69 73 20 | 63 6f 6d 70 75 74 69 6e |ment is |computin|
|00000e90| 67 20 69 74 73 20 6e 65 | 78 74 20 73 74 61 74 65 |g its ne|xt state|
|00000ea0| 2e 20 0a 0a 3c 50 3e 20 | 54 68 65 20 69 6e 74 65 |. ..<P> |The inte|
|00000eb0| 72 66 61 63 65 20 73 75 | 70 70 6f 72 74 73 20 65 |rface su|pports e|
|00000ec0| 69 74 68 65 72 20 74 72 | 69 61 6c 2d 62 61 73 65 |ither tr|ial-base|
|00000ed0| 64 20 6f 72 20 63 6f 6e | 74 69 6e 75 61 6c 6c 79 |d or con|tinually|
|00000ee0| 20 72 75 6e 6e 69 6e 67 | 0a 73 69 6d 75 6c 61 74 | running|.simulat|
|00000ef0| 69 6f 6e 73 2e 20 43 6f | 6e 74 69 6e 75 61 6c 6c |ions. Co|ntinuall|
|00000f00| 79 20 72 75 6e 6e 69 6e | 67 20 73 69 6d 75 6c 61 |y runnin|g simula|
|00000f10| 74 69 6f 6e 73 20 61 72 | 65 20 74 72 65 61 74 65 |tions ar|e treate|
|00000f20| 64 20 73 69 6d 70 6c 79 | 20 61 73 20 61 0a 73 69 |d simply| as a.si|
|00000f30| 6e 67 6c 65 20 74 72 69 | 61 6c 20 74 68 61 74 20 |ngle tri|al that |
|00000f40| 6e 65 76 65 72 20 65 6e | 64 73 2e 0a 0a 3c 50 3e |never en|ds...<P>|
|00000f50| 20 49 6e 20 61 20 74 79 | 70 69 63 61 6c 20 75 73 | In a ty|pical us|
|00000f60| 65 20 6f 66 20 74 68 65 | 20 69 6e 74 65 72 66 61 |e of the| interfa|
|00000f70| 63 65 2c 20 74 68 65 20 | 75 73 65 72 20 66 69 72 |ce, the |user fir|
|00000f80| 73 74 20 64 65 66 69 6e | 65 73 20 61 6e 79 0a 6e |st defin|es any.n|
|00000f90| 65 65 64 65 64 20 73 70 | 65 63 69 61 6c 69 7a 65 |eeded sp|ecialize|
|00000fa0| 64 20 6f 62 6a 65 63 74 | 20 63 6c 61 73 73 65 73 |d object| classes|
|00000fb0| 20 61 6e 64 20 74 68 65 | 6e 20 63 72 65 61 74 65 | and the|n create|
|00000fc0| 73 20 68 65 72 20 6e 65 | 77 20 61 67 65 6e 74 2c |s her ne|w agent,|
|00000fd0| 0a 65 6e 76 69 72 6f 6e | 6d 65 6e 74 2c 20 61 6e |.environ|ment, an|
|00000fe0| 64 20 73 69 6d 75 6c 61 | 74 69 6f 6e 20 62 79 20 |d simula|tion by |
|00000ff0| 63 72 65 61 74 69 6e 67 | 20 61 6e 20 69 6e 73 74 |creating| an inst|
|00001000| 61 6e 63 65 20 6f 66 20 | 65 61 63 68 2e 20 20 54 |ance of |each. T|
|00001010| 68 65 0a 61 67 65 6e 74 | 20 61 6e 64 20 65 6e 76 |he.agent| and env|
|00001020| 69 72 6f 6e 6d 65 6e 74 | 20 61 72 65 20 74 68 65 |ironment| are the|
|00001030| 6e 20 70 61 73 73 65 64 | 20 74 6f 20 3c 43 4f 44 |n passed| to <COD|
|00001040| 45 3e 53 69 6d 75 6c 61 | 74 69 6f 6e 3a 3a 69 6e |E>Simula|tion::in|
|00001050| 69 74 3c 2f 43 4f 44 45 | 3e 0a 77 68 69 63 68 20 |it</CODE|>.which |
|00001060| 69 6e 69 74 69 61 6c 69 | 7a 65 73 20 61 6e 64 20 |initiali|zes and |
|00001070| 69 6e 74 65 72 63 6f 6e | 6e 65 63 74 73 20 74 68 |intercon|nects th|
|00001080| 65 6d 2e 20 20 46 69 6e | 61 6c 6c 79 2c 20 63 61 |em. Fin|ally, ca|
|00001090| 6c 6c 73 20 74 6f 0a 3c | 43 4f 44 45 3e 53 69 6d |lls to.<|CODE>Sim|
|000010a0| 75 6c 61 74 69 6f 6e 3a | 3a 73 74 65 70 73 3c 2f |ulation:|:steps</|
|000010b0| 43 4f 44 45 3e 20 6f 72 | 0a 3c 43 4f 44 45 3e 53 |CODE> or|.<CODE>S|
|000010c0| 69 6d 75 6c 61 74 69 6f | 6e 3a 3a 74 72 69 61 6c |imulatio|n::trial|
|000010d0| 73 3c 2f 43 4f 44 45 3e | 20 61 63 74 75 61 6c 6c |s</CODE>| actuall|
|000010e0| 79 20 72 75 6e 20 74 68 | 65 20 73 69 6d 75 6c 61 |y run th|e simula|
|000010f0| 74 69 6f 6e 2e 0a 48 65 | 72 65 20 69 73 20 61 20 |tion..He|re is a |
|00001100| 70 72 6f 74 6f 74 79 70 | 69 63 61 6c 20 65 78 61 |prototyp|ical exa|
|00001110| 6d 70 6c 65 3a 0a 0a 3c | 41 20 4e 41 4d 45 3d 22 |mple:..<|A NAME="|
|00001120| 70 72 6f 74 6f 2d 65 78 | 61 6d 70 6c 65 22 3e 3c |proto-ex|ample"><|
|00001130| 2f 41 3e 0a 3c 62 6c 6f | 63 6b 71 75 6f 74 65 3e |/A>.<blo|ckquote>|
|00001140| 3c 70 72 65 3e 0a 23 69 | 6e 63 6c 75 64 65 20 22 |<pre>.#i|nclude "|
|00001150| 72 6c 69 2e 68 22 0a 0a | 3c 49 3e 2f 2f 20 64 65 |rli.h"..|<I>// de|
|00001160| 63 6c 61 72 65 20 3c 43 | 4f 44 45 3e 4d 79 5f 41 |clare <C|ODE>My_A|
|00001170| 67 65 6e 74 3c 2f 43 4f | 44 45 3e 3c 2f 49 3e 0a |gent</CO|DE></I>.|
|00001180| 0a 63 6c 61 73 73 20 3c | 43 4f 44 45 3e 4d 79 5f |.class <|CODE>My_|
|00001190| 41 67 65 6e 74 3c 2f 43 | 4f 44 45 3e 20 3a 20 70 |Agent</C|ODE> : p|
|000011a0| 75 62 6c 69 63 20 3c 43 | 4f 44 45 3e 41 67 65 6e |ublic <C|ODE>Agen|
|000011b0| 74 3c 2f 43 4f 44 45 3e | 20 7b 0a 70 75 62 6c 69 |t</CODE>| {.publi|
|000011c0| 63 3a 0a 0a 20 20 20 76 | 6f 69 64 20 20 20 20 3c |c:.. v|oid <|
|000011d0| 43 4f 44 45 3e 69 6e 69 | 74 3c 2f 43 4f 44 45 3e |CODE>ini|t</CODE>|
|000011e0| 28 20 69 6e 74 20 3c 56 | 41 52 3e 61 72 67 63 3c |( int <V|AR>argc<|
|000011f0| 2f 56 41 52 3e 2c 20 63 | 68 61 72 20 2a 3c 56 41 |/VAR>, c|har *<VA|
|00001200| 52 3e 61 72 67 76 3c 2f | 56 41 52 3e 5b 5d 20 29 |R>argv</|VAR>[] )|
|00001210| 3b 0a 0a 20 20 20 41 63 | 74 69 6f 6e 20 2a 3c 43 |;.. Ac|tion *<C|
|00001220| 4f 44 45 3e 73 74 61 72 | 74 5f 74 72 69 61 6c 3c |ODE>star|t_trial<|
|00001230| 2f 43 4f 44 45 3e 28 20 | 63 6f 6e 73 74 20 53 65 |/CODE>( |const Se|
|00001240| 6e 73 61 74 69 6f 6e 2a | 20 3c 56 41 52 3e 70 73 |nsation*| <VAR>ps|
|00001250| 3c 2f 56 41 52 3e 20 29 | 3b 0a 0a 20 20 20 41 63 |</VAR> )|;.. Ac|
|00001260| 74 69 6f 6e 20 2a 3c 43 | 4f 44 45 3e 73 74 65 70 |tion *<C|ODE>step|
|00001270| 3c 2f 43 4f 44 45 3e 28 | 20 63 6f 6e 73 74 20 53 |</CODE>(| const S|
|00001280| 65 6e 73 61 74 69 6f 6e | 20 2a 3c 56 41 52 3e 70 |ensation| *<VAR>p|
|00001290| 6e 65 78 74 5f 73 3c 2f | 56 41 52 3e 2c 0a 20 20 |next_s</|VAR>,. |
|000012a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 64 | | d|
|000012b0| 6f 75 62 6c 65 20 20 20 | 20 20 20 20 20 20 20 20 |ouble | |
|000012c0| 3c 56 41 52 3e 72 65 77 | 61 72 64 3c 2f 56 41 52 |<VAR>rew|ard</VAR|
|000012d0| 3e 20 29 3b 20 0a 7d 3b | 0a 0a 3c 49 3e 2f 2f 20 |> ); .};|..<I>// |
|000012e0| 49 6d 70 6c 65 6d 65 6e | 74 61 74 69 6f 6e 20 6f |Implemen|tation o|
|000012f0| 66 20 3c 43 4f 44 45 3e | 4d 79 5f 41 67 65 6e 74 |f <CODE>|My_Agent|
|00001300| 3c 2f 43 4f 44 45 3e 3c | 2f 49 3e 0a 3c 49 3e 20 |</CODE><|/I>.<I> |
|00001310| 20 20 2e 3c 2f 49 3e 0a | 3c 49 3e 20 20 20 2e 3c | .</I>.|<I> .<|
|00001320| 2f 49 3e 0a 3c 49 3e 20 | 20 20 2e 3c 2f 49 3e 0a |/I>.<I> | .</I>.|
|00001330| 0a 3c 49 3e 2f 2f 20 64 | 65 63 6c 61 72 65 20 3c |.<I>// d|eclare <|
|00001340| 43 4f 44 45 3e 4d 79 5f | 45 6e 76 69 72 6f 6e 6d |CODE>My_|Environm|
|00001350| 65 6e 74 3c 2f 43 4f 44 | 45 3e 3c 2f 49 3e 0a 0a |ent</COD|E></I>..|
|00001360| 63 6c 61 73 73 20 3c 43 | 4f 44 45 3e 4d 79 5f 45 |class <C|ODE>My_E|
|00001370| 6e 76 3c 2f 43 4f 44 45 | 3e 20 3a 20 70 75 62 6c |nv</CODE|> : publ|
|00001380| 69 63 20 3c 43 4f 44 45 | 3e 45 6e 76 69 72 6f 6e |ic <CODE|>Environ|
|00001390| 6d 65 6e 74 3c 2f 43 4f | 44 45 3e 20 7b 0a 70 75 |ment</CO|DE> {.pu|
|000013a0| 62 6c 69 63 3a 0a 20 20 | 20 76 6f 69 64 20 20 20 |blic:. | void |
|000013b0| 20 20 20 20 3c 43 4f 44 | 45 3e 69 6e 69 74 3c 2f | <COD|E>init</|
|000013c0| 43 4f 44 45 3e 28 20 69 | 6e 74 20 3c 56 41 52 3e |CODE>( i|nt <VAR>|
|000013d0| 61 72 67 63 3c 2f 56 41 | 52 3e 2c 20 63 68 61 72 |argc</VA|R>, char|
|000013e0| 20 2a 3c 56 41 52 3e 61 | 72 67 76 3c 2f 56 41 52 | *<VAR>a|rgv</VAR|
|000013f0| 3e 5b 5d 20 29 3b 0a 0a | 20 20 20 53 65 6e 73 61 |>[] );..| Sensa|
|00001400| 74 69 6f 6e 20 2a 3c 43 | 4f 44 45 3e 73 74 61 72 |tion *<C|ODE>star|
|00001410| 74 5f 74 72 69 61 6c 3c | 2f 43 4f 44 45 3e 28 20 |t_trial<|/CODE>( |
|00001420| 76 6f 69 64 20 29 3b 0a | 0a 20 20 20 76 6f 69 64 |void );.|. void|
|00001430| 20 20 20 20 20 20 20 3c | 43 4f 44 45 3e 73 74 65 | <|CODE>ste|
|00001440| 70 3c 2f 43 4f 44 45 3e | 28 20 63 6f 6e 73 74 20 |p</CODE>|( const |
|00001450| 41 63 74 69 6f 6e 20 20 | 2a 3c 56 41 52 3e 70 61 |Action |*<VAR>pa|
|00001460| 3c 2f 56 41 52 3e 2c 0a | 20 20 20 20 20 20 20 20 |</VAR>,.| |
|00001470| 20 20 20 20 20 20 20 20 | 20 20 20 20 53 65 6e 73 | | Sens|
|00001480| 61 74 69 6f 6e 20 20 20 | 20 2a 26 61 6d 70 3b 3c |ation | *&<|
|00001490| 56 41 52 3e 70 6e 65 78 | 74 5f 73 3c 2f 56 41 52 |VAR>pnex|t_s</VAR|
|000014a0| 3e 2c 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |>,. | |
|000014b0| 20 20 20 20 20 20 20 64 | 6f 75 62 6c 65 20 20 20 | d|ouble |
|000014c0| 20 20 20 20 20 26 61 6d | 70 3b 3c 56 41 52 3e 72 | &am|p;<VAR>r|
|000014d0| 65 77 61 72 64 3c 2f 56 | 41 52 3e 20 29 3b 0a 7d |eward</V|AR> );.}|
|000014e0| 3b 0a 0a 3c 49 3e 2f 2f | 20 49 6d 70 6c 65 6d 65 |;..<I>//| Impleme|
|000014f0| 6e 74 61 74 69 6f 6e 20 | 6f 66 20 3c 43 4f 44 45 |ntation |of <CODE|
|00001500| 3e 4d 79 5f 45 6e 76 69 | 72 6f 6e 6d 65 6e 74 3c |>My_Envi|ronment<|
|00001510| 2f 43 4f 44 45 3e 3c 2f | 49 3e 0a 3c 49 3e 20 20 |/CODE></|I>.<I> |
|00001520| 20 2e 3c 2f 49 3e 0a 3c | 49 3e 20 20 20 2e 3c 2f | .</I>.<|I> .</|
|00001530| 49 3e 0a 3c 49 3e 20 20 | 20 2e 3c 2f 49 3e 0a 0a |I>.<I> | .</I>..|
|00001540| 69 6e 74 20 6d 61 69 6e | 28 20 69 6e 74 20 3c 56 |int main|( int <V|
|00001550| 41 52 3e 61 72 67 63 3c | 2f 56 41 52 3e 2c 20 63 |AR>argc<|/VAR>, c|
|00001560| 68 61 72 20 2a 3c 56 41 | 52 3e 61 72 67 76 3c 2f |har *<VA|R>argv</|
|00001570| 56 41 52 3e 5b 5d 20 29 | 0a 7b 0a 20 20 20 3c 43 |VAR>[] )|.{. <C|
|00001580| 4f 44 45 3e 4d 79 5f 41 | 67 65 6e 74 3c 2f 43 4f |ODE>My_A|gent</CO|
|00001590| 44 45 3e 20 20 20 2a 3c | 56 41 52 3e 70 61 3c 2f |DE> *<|VAR>pa</|
|000015a0| 56 41 52 3e 20 3d 20 6e | 65 77 20 3c 56 41 52 3e |VAR> = n|ew <VAR>|
|000015b0| 4d 79 5f 41 67 65 6e 74 | 3c 2f 56 41 52 3e 3b 0a |My_Agent|</VAR>;.|
|000015c0| 20 20 20 3c 43 4f 44 45 | 3e 4d 79 5f 45 6e 76 3c | <CODE|>My_Env<|
|000015d0| 2f 43 4f 44 45 3e 20 20 | 20 20 20 2a 3c 56 41 52 |/CODE> | *<VAR|
|000015e0| 3e 70 65 3c 2f 56 41 52 | 3e 20 3d 20 6e 65 77 20 |>pe</VAR|> = new |
|000015f0| 3c 56 41 52 3e 4d 79 5f | 45 6e 76 3c 2f 56 41 52 |<VAR>My_|Env</VAR|
|00001600| 3e 3b 0a 0a 20 20 20 3c | 43 4f 44 45 3e 53 69 6d |>;.. <|CODE>Sim|
|00001610| 75 6c 61 74 69 6f 6e 3c | 2f 43 4f 44 45 3e 20 3c |ulation<|/CODE> <|
|00001620| 56 41 52 3e 73 69 6d 3c | 2f 56 41 52 3e 28 3c 56 |VAR>sim<|/VAR>(<V|
|00001630| 41 52 3e 70 61 3c 2f 56 | 41 52 3e 2c 3c 56 41 52 |AR>pa</V|AR>,<VAR|
|00001640| 3e 70 65 3c 2f 56 41 52 | 3e 29 3b 0a 0a 3c 49 3e |>pe</VAR|>);..<I>|
|00001650| 20 20 20 2f 2f 20 49 6e | 69 74 69 61 6c 69 7a 65 | // In|itialize|
|00001660| 20 73 69 6d 75 6c 61 74 | 69 6f 6e 20 3c 2f 49 3e | simulat|ion </I>|
|00001670| 0a 0a 20 20 20 3c 56 41 | 52 3e 73 69 6d 3c 2f 56 |.. <VA|R>sim</V|
|00001680| 41 52 3e 2e 3c 43 4f 44 | 45 3e 69 6e 69 74 3c 2f |AR>.<COD|E>init</|
|00001690| 43 4f 44 45 3e 28 20 3c | 56 41 52 3e 61 72 67 63 |CODE>( <|VAR>argc|
|000016a0| 3c 2f 56 41 52 3e 2c 20 | 3c 56 41 52 3e 61 72 67 |</VAR>, |<VAR>arg|
|000016b0| 76 3c 2f 56 41 52 3e 20 | 29 3b 0a 0a 3c 49 3e 20 |v</VAR> |);..<I> |
|000016c0| 20 20 2f 2f 20 52 75 6e | 20 31 30 30 30 20 73 74 | // Run| 1000 st|
|000016d0| 65 70 73 20 3c 2f 49 3e | 0a 0a 20 20 20 3c 56 41 |eps </I>|.. <VA|
|000016e0| 52 3e 73 69 6d 3c 2f 56 | 41 52 3e 2e 3c 43 4f 44 |R>sim</V|AR>.<COD|
|000016f0| 45 3e 73 74 65 70 73 3c | 2f 43 4f 44 45 3e 28 20 |E>steps<|/CODE>( |
|00001700| 31 30 30 30 20 29 3b 0a | 7d 0a 0a 3c 2f 70 72 65 |1000 );.|}..</pre|
|00001710| 3e 3c 2f 62 6c 6f 63 6b | 71 75 6f 74 65 3e 0a 0a |></block|quote>..|
|00001720| 41 20 63 6f 6d 70 6c 65 | 74 65 20 65 78 61 6d 70 |A comple|te examp|
|00001730| 6c 65 20 69 6e 63 6c 75 | 64 69 6e 67 20 64 65 66 |le inclu|ding def|
|00001740| 69 6e 69 74 69 6f 6e 73 | 20 6f 66 20 73 70 65 63 |initions| of spec|
|00001750| 69 66 69 63 20 61 67 65 | 6e 74 20 61 6e 64 0a 65 |ific age|nt and.e|
|00001760| 6e 76 69 72 6f 6e 6d 65 | 6e 74 20 63 6c 61 73 73 |nvironme|nt class|
|00001770| 65 73 20 69 73 20 67 69 | 76 65 6e 20 69 6e 20 74 |es is gi|ven in t|
|00001780| 68 65 20 3c 61 20 68 72 | 65 66 3d 22 23 64 6f 75 |he <a hr|ef="#dou|
|00001790| 62 6c 65 2d 69 6e 74 65 | 67 72 61 74 6f 72 22 3e |ble-inte|grator">|
|000017a0| 66 69 6e 61 6c 20 73 65 | 63 74 69 6f 6e 3c 2f 61 |final se|ction</a|
|000017b0| 3e 20 6f 66 20 74 68 69 | 73 20 64 6f 63 75 6d 65 |> of thi|s docume|
|000017c0| 6e 74 2e 0a 0a 3c 50 3e | 20 4e 6f 74 65 20 74 68 |nt...<P>| Note th|
|000017d0| 61 74 20 61 6c 6c 20 74 | 68 65 20 64 6f 63 75 6d |at all t|he docum|
|000017e0| 65 6e 74 61 74 69 6f 6e | 20 66 6f 72 20 61 6c 6c |entation| for all|
|000017f0| 20 6f 62 6a 65 63 74 73 | 20 61 6e 64 20 72 6f 75 | objects| and rou|
|00001800| 74 69 6e 65 73 0a 69 6e | 63 6c 75 64 65 73 20 48 |tines.in|cludes H|
|00001810| 54 4d 4c 20 61 6e 63 68 | 6f 72 73 20 74 6f 20 66 |TML anch|ors to f|
|00001820| 61 63 69 6c 69 74 61 74 | 65 20 61 75 74 6f 6d 61 |acilitat|e automa|
|00001830| 74 69 63 20 69 6e 64 65 | 78 69 6e 67 20 69 6e 74 |tic inde|xing int|
|00001840| 6f 20 74 68 69 73 0a 64 | 6f 63 75 6d 65 6e 74 2e |o this.d|ocument.|
|00001850| 20 20 4c 69 6e 6b 73 20 | 74 6f 20 74 68 65 20 73 | Links |to the s|
|00001860| 6f 75 72 63 65 20 63 6f | 64 65 20 61 72 65 20 61 |ource co|de are a|
|00001870| 6c 73 6f 20 70 72 6f 76 | 69 64 65 64 2e 20 20 46 |lso prov|ided. F|
|00001880| 6f 72 20 61 6e 79 0a 3c | 42 3e 43 2b 2b 3c 2f 42 |or any.<|B>C++</B|
|00001890| 3e 20 65 6e 74 69 74 79 | 20 77 69 74 68 20 61 20 |> entity| with a |
|000018a0| 62 72 61 63 6b 65 74 65 | 64 20 64 65 73 63 72 69 |brackete|d descri|
|000018b0| 70 74 6f 72 20 74 6f 20 | 69 74 73 20 72 69 67 68 |ptor to |its righ|
|000018c0| 74 20 28 65 2e 67 2e 2c | 0a 5b 66 75 6e 63 74 69 |t (e.g.,|.[functi|
|000018d0| 6f 6e 5d 29 2c 20 69 74 | 73 20 73 6f 75 72 63 65 |on]), it|s source|
|000018e0| 20 63 6f 64 65 20 63 61 | 6e 20 62 65 20 62 72 6f | code ca|n be bro|
|000018f0| 75 67 68 74 20 75 70 20 | 62 79 20 63 6c 69 63 6b |ught up |by click|
|00001900| 69 6e 67 20 6f 6e 20 74 | 68 65 0a 62 72 61 63 6b |ing on t|he.brack|
|00001910| 65 74 65 64 20 77 6f 72 | 64 73 2e 0a 0a 3c 48 52 |eted wor|ds...<HR|
|00001920| 3e 0a 0a 3c 41 20 4e 41 | 4d 45 3d 22 41 67 65 6e |>..<A NA|ME="Agen|
|00001930| 74 22 3e 0a 3c 48 32 3e | 41 67 65 6e 74 3c 2f 48 |t">.<H2>|Agent</H|
|00001940| 32 3e 0a 3c 2f 41 3e 0a | 0a 3c 50 3e 20 54 68 65 |2>.</A>.|.<P> The|
|00001950| 20 61 67 65 6e 74 20 69 | 73 20 74 68 65 20 65 6e | agent i|s the en|
|00001960| 74 69 74 79 20 74 68 61 | 74 20 69 6e 74 65 72 61 |tity tha|t intera|
|00001970| 63 74 73 20 77 69 74 68 | 20 74 68 65 20 65 6e 76 |cts with| the env|
|00001980| 69 72 6f 6e 6d 65 6e 74 | 2c 20 74 68 61 74 0a 72 |ironment|, that.r|
|00001990| 65 63 65 69 76 65 73 20 | 73 65 6e 61 74 69 6f 6e |eceives |senation|
|000019a0| 73 20 61 6e 64 20 73 65 | 6c 65 63 74 73 20 61 63 |s and se|lects ac|
|000019b0| 74 69 6f 6e 73 2e 20 20 | 54 68 65 20 61 67 65 6e |tions. |The agen|
|000019c0| 74 20 6d 61 79 20 6f 72 | 20 6d 61 79 20 6e 6f 74 |t may or| may not|
|000019d0| 0a 6c 65 61 72 6e 2c 20 | 6d 61 79 20 6f 72 20 6d |.learn, |may or m|
|000019e0| 61 79 20 6e 6f 74 20 62 | 75 69 6c 64 20 61 20 6d |ay not b|uild a m|
|000019f0| 6f 64 65 6c 20 6f 66 20 | 74 68 65 20 65 6e 76 69 |odel of |the envi|
|00001a00| 72 6f 6e 6d 65 6e 74 2c | 20 65 74 63 2e 0a 0a 3c |ronment,| etc...<|
|00001a10| 70 3e 0a 3c 44 49 56 20 | 41 4c 49 47 4e 3d 52 49 |p>.<DIV |ALIGN=RI|
|00001a20| 47 48 54 3e 0a 5b 3c 41 | 20 48 52 45 46 3d 22 72 |GHT>.[<A| HREF="r|
|00001a30| 6c 69 2e 68 2e 68 74 6d | 6c 23 41 67 65 6e 74 22 |li.h.htm|l#Agent"|
|00001a40| 3e 61 62 73 74 72 61 63 | 74 20 63 6c 61 73 73 3c |>abstrac|t class<|
|00001a50| 2f 41 3e 5d 0a 3c 2f 44 | 49 56 3e 20 0a 3c 54 54 |/A>].</D|IV> .<TT|
|00001a60| 3e 3c 42 3e 3c 43 4f 44 | 45 3e 41 67 65 6e 74 3c |><B><COD|E>Agent<|
|00001a70| 2f 43 4f 44 45 3e 3c 2f | 42 3e 3c 2f 54 54 3e 0a |/CODE></|B></TT>.|
|00001a80| 0a 3c 50 3e 54 68 65 20 | 62 61 73 65 20 63 6c 61 |.<P>The |base cla|
|00001a90| 73 73 20 6f 66 20 61 6c | 6c 20 61 67 65 6e 74 73 |ss of al|l agents|
|00001aa0| 2e 20 20 53 70 65 63 69 | 66 69 63 20 61 67 65 6e |. Speci|fic agen|
|00001ab0| 74 73 20 61 72 65 20 69 | 6e 73 74 61 6e 63 65 73 |ts are i|nstances|
|00001ac0| 20 6f 66 0a 73 75 62 63 | 6c 61 73 73 65 73 20 64 | of.subc|lasses d|
|00001ad0| 65 72 69 76 65 64 20 66 | 72 6f 6d 20 3c 43 4f 44 |erived f|rom <COD|
|00001ae0| 45 3e 41 67 65 6e 74 3c | 2f 43 4f 44 45 3e 2e 20 |E>Agent<|/CODE>. |
|00001af0| 20 55 73 65 72 20 64 65 | 66 69 6e 65 64 20 61 67 | User de|fined ag|
|00001b00| 65 6e 74 0a 63 6c 61 73 | 73 65 73 20 28 73 75 62 |ent.clas|ses (sub|
|00001b10| 63 6c 61 73 73 65 73 20 | 6f 66 20 3c 43 4f 44 45 |classes |of <CODE|
|00001b20| 3e 41 67 65 6e 74 3c 2f | 43 4f 44 45 3e 29 20 77 |>Agent</|CODE>) w|
|00001b30| 69 6c 6c 20 6e 6f 72 6d | 61 6c 6c 79 20 70 72 6f |ill norm|ally pro|
|00001b40| 76 69 64 65 0a 73 70 65 | 63 69 61 6c 69 7a 65 64 |vide.spe|cialized|
|00001b50| 20 64 65 66 69 6e 69 74 | 69 6f 6e 73 20 6f 66 20 | definit|ions of |
|00001b60| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 74 68 |the foll|owing th|
|00001b70| 72 65 65 20 66 75 6e 63 | 74 69 6f 6e 73 2e 0a 0a |ree func|tions...|
|00001b80| 3c 70 3e 0a 3c 41 20 4e | 41 4d 45 3d 22 41 67 65 |<p>.<A N|AME="Age|
|00001b90| 6e 74 3a 3a 69 6e 69 74 | 22 3e 0a 3c 44 49 56 20 |nt::init|">.<DIV |
|00001ba0| 41 4c 49 47 4e 3d 52 49 | 47 48 54 3e 0a 5b 3c 41 |ALIGN=RI|GHT>.[<A|
|00001bb0| 20 48 52 45 46 3d 22 72 | 6c 69 2e 63 63 2e 68 74 | HREF="r|li.cc.ht|
|00001bc0| 6d 6c 23 41 67 65 6e 74 | 3a 3a 69 6e 69 74 22 3e |ml#Agent|::init">|
|00001bd0| 76 69 72 74 75 61 6c 20 | 66 75 6e 63 74 69 6f 6e |virtual |function|
|00001be0| 3c 2f 41 3e 5d 0a 3c 2f | 44 49 56 3e 20 0a 3c 2f |</A>].</|DIV> .</|
|00001bf0| 41 3e 0a 3c 54 54 3e 0a | 76 6f 69 64 20 3c 42 3e |A>.<TT>.|void <B>|
|00001c00| 3c 43 4f 44 45 3e 41 67 | 65 6e 74 3a 3a 69 6e 69 |<CODE>Ag|ent::ini|
|00001c10| 74 3c 2f 43 4f 44 45 3e | 3c 2f 42 3e 0a 28 20 69 |t</CODE>|</B>.( i|
|00001c20| 6e 74 20 3c 56 41 52 3e | 61 72 67 63 3c 2f 56 41 |nt <VAR>|argc</VA|
|00001c30| 52 3e 2c 20 63 68 61 72 | 20 2a 3c 56 41 52 3e 61 |R>, char| *<VAR>a|
|00001c40| 72 67 76 3c 2f 56 41 52 | 3e 5b 5d 20 29 0a 3c 2f |rgv</VAR|>[] ).</|
|00001c50| 54 54 3e 0a 0a 3c 50 3e | 54 68 69 73 20 66 75 6e |TT>..<P>|This fun|
|00001c60| 63 74 69 6f 6e 20 69 73 | 20 6e 6f 72 6d 61 6c 6c |ction is| normall|
|00001c70| 79 20 70 72 6f 76 69 64 | 65 64 20 62 79 20 74 68 |y provid|ed by th|
|00001c80| 65 20 75 73 65 72 20 66 | 6f 72 20 68 65 72 20 73 |e user f|or her s|
|00001c90| 70 65 63 69 61 6c 69 7a | 65 64 0a 61 67 65 6e 74 |pecializ|ed.agent|
|00001ca0| 20 63 6c 61 73 73 2e 20 | 20 3c 43 4f 44 45 3e 41 | class. | <CODE>A|
|00001cb0| 67 65 6e 74 3a 3a 69 6e | 69 74 3c 2f 43 4f 44 45 |gent::in|it</CODE|
|00001cc0| 3e 20 73 68 6f 75 6c 64 | 20 69 6e 69 74 69 61 6c |> should| initial|
|00001cd0| 69 7a 65 20 74 68 65 0a | 69 6e 73 74 61 6e 63 65 |ize the.|instance|
|00001ce0| 20 6f 66 20 74 68 65 20 | 61 67 65 6e 74 2c 20 6d | of the |agent, m|
|00001cf0| 61 6b 69 6e 67 20 61 6e | 79 20 6e 65 65 64 65 64 |aking an|y needed|
|00001d00| 20 64 61 74 61 2d 73 74 | 72 75 63 74 75 72 65 73 | data-st|ructures|
|00001d10| 2e 20 20 49 66 20 74 68 | 65 0a 61 67 65 6e 74 20 |. If th|e.agent |
|00001d20| 6c 65 61 72 6e 73 20 6f | 72 20 63 68 61 6e 67 65 |learns o|r change|
|00001d30| 73 20 69 6e 20 61 6e 79 | 20 77 61 79 20 77 69 74 |s in any| way wit|
|00001d40| 68 20 65 78 70 65 72 69 | 65 6e 63 65 2c 20 74 68 |h experi|ence, th|
|00001d50| 65 6e 20 74 68 69 73 20 | 66 75 6e 63 74 69 6f 6e |en this |function|
|00001d60| 0a 73 68 6f 75 6c 64 20 | 72 65 73 65 74 20 69 74 |.should |reset it|
|00001d70| 20 74 6f 20 69 74 73 20 | 6f 72 69 67 69 6e 61 6c | to its |original|
|00001d80| 2c 20 6e 61 69 76 65 20 | 63 6f 6e 64 69 74 69 6f |, naive |conditio|
|00001d90| 6e 2e 20 20 54 68 65 20 | 69 6e 70 75 74 20 61 72 |n. The |input ar|
|00001da0| 67 75 6d 65 6e 74 73 0a | 70 72 6f 76 69 64 65 20 |guments.|provide |
|00001db0| 74 68 65 20 67 65 6e 65 | 72 69 63 20 63 6f 6d 6d |the gene|ric comm|
|00001dc0| 61 6e 64 2d 6c 69 6e 65 | 20 69 6e 69 74 69 61 6c |and-line| initial|
|00001dd0| 69 7a 61 74 69 6f 6e 20 | 70 61 72 61 6d 65 74 65 |ization |paramete|
|00001de0| 72 73 20 75 73 69 6e 67 | 0a 74 68 65 20 73 74 61 |rs using|.the sta|
|00001df0| 6e 64 61 72 64 20 66 6f | 72 6d 61 74 20 28 69 2e |ndard fo|rmat (i.|
|00001e00| 65 2e 2c 20 3c 56 41 52 | 3e 61 72 67 63 3c 2f 56 |e., <VAR|>argc</V|
|00001e10| 41 52 3e 20 69 73 20 74 | 68 65 20 6e 75 6d 62 65 |AR> is t|he numbe|
|00001e20| 72 20 6f 66 0a 63 6f 6d | 6d 61 6e 64 2d 6c 69 6e |r of.com|mand-lin|
|00001e30| 65 20 70 61 72 61 6d 65 | 74 65 72 73 20 61 6e 64 |e parame|ters and|
|00001e40| 20 3c 56 41 52 3e 61 72 | 67 76 3c 2f 56 41 52 3e | <VAR>ar|gv</VAR>|
|00001e50| 20 69 73 20 74 68 65 20 | 61 72 72 61 79 20 6f 66 | is the |array of|
|00001e60| 20 70 6f 69 6e 74 65 72 | 73 0a 74 6f 20 73 74 72 | pointer|s.to str|
|00001e70| 69 6e 67 73 29 2e 20 4e | 6f 72 6d 61 6c 6c 79 2c |ings). N|ormally,|
|00001e80| 20 3c 43 4f 44 45 3e 41 | 67 65 6e 74 3a 3a 69 6e | <CODE>A|gent::in|
|00001e90| 69 74 3c 2f 43 4f 44 45 | 3e 20 69 73 20 63 61 6c |it</CODE|> is cal|
|00001ea0| 6c 65 64 20 6f 6e 63 65 | 20 77 68 65 6e 0a 74 68 |led once| when.th|
|00001eb0| 65 20 73 69 6d 75 6c 61 | 74 69 6f 6e 20 69 73 20 |e simula|tion is |
|00001ec0| 66 69 72 73 74 20 61 73 | 73 65 6d 62 6c 65 64 20 |first as|sembled |
|00001ed0| 61 6e 64 20 69 6e 69 74 | 69 61 6c 69 7a 65 64 2e |and init|ialized.|
|00001ee0| 20 20 54 68 65 20 64 65 | 66 61 75 6c 74 0a 69 6d | The de|fault.im|
|00001ef0| 70 6c 65 6d 65 6e 74 61 | 74 69 6f 6e 20 66 6f 72 |plementa|tion for|
|00001f00| 20 3c 43 4f 44 45 3e 41 | 67 65 6e 74 3a 3a 69 6e | <CODE>A|gent::in|
|00001f10| 69 74 3c 2f 43 4f 44 45 | 3e 20 64 6f 65 73 20 6e |it</CODE|> does n|
|00001f20| 6f 74 68 69 6e 67 2e 0a | 0a 3c 50 3e 49 66 20 6e |othing..|.<P>If n|
|00001f30| 65 65 64 65 64 2c 20 74 | 68 65 20 61 67 65 6e 74 |eeded, t|he agent|
|00001f40| 20 63 61 6e 20 63 6f 6e | 73 75 6c 74 20 77 69 74 | can con|sult wit|
|00001f50| 68 20 74 68 65 20 65 6e | 76 69 72 6f 6e 6d 65 6e |h the en|vironmen|
|00001f60| 74 20 6f 72 20 74 68 65 | 0a 73 69 6d 75 6c 61 74 |t or the|.simulat|
|00001f70| 69 6f 6e 20 61 73 20 70 | 61 72 74 20 6f 66 20 73 |ion as p|art of s|
|00001f80| 65 74 74 69 6e 67 20 75 | 70 20 69 74 73 20 69 6e |etting u|p its in|
|00001f90| 69 74 69 61 6c 69 7a 61 | 74 69 6f 6e 20 28 61 6c |itializa|tion (al|
|00001fa0| 74 68 6f 75 67 68 20 61 | 74 0a 70 72 65 73 65 6e |though a|t.presen|
|00001fb0| 74 20 6e 6f 20 73 74 61 | 6e 64 61 72 64 20 69 6e |t no sta|ndard in|
|00001fc0| 74 65 72 66 61 63 65 20 | 68 61 73 20 62 65 65 6e |terface |has been|
|00001fd0| 20 64 65 66 69 6e 65 64 | 20 66 6f 72 20 74 68 69 | defined| for thi|
|00001fe0| 73 20 73 6f 72 74 20 6f | 66 0a 69 6e 74 65 72 61 |s sort o|f.intera|
|00001ff0| 63 74 69 6f 6e 29 2e 20 | 20 54 68 65 20 61 67 65 |ction). | The age|
|00002000| 6e 74 20 63 61 6e 20 61 | 63 63 65 73 73 20 74 68 |nt can a|ccess th|
|00002010| 65 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 20 61 6e |e enviro|nment an|
|00002020| 64 20 73 69 6d 75 6c 61 | 74 69 6f 6e 20 62 79 0a |d simula|tion by.|
|00002030| 61 63 63 65 73 73 69 6e | 67 20 74 68 65 20 3c 41 |accessin|g the <A|
|00002040| 20 48 52 45 46 3d 22 23 | 63 72 6f 73 73 2d 72 65 | HREF="#|cross-re|
|00002050| 66 65 72 65 6e 63 65 22 | 3e 3c 56 41 52 3e 41 67 |ference"|><VAR>Ag|
|00002060| 65 6e 74 3a 3a 70 73 69 | 6d 3c 2f 56 41 52 3e 3c |ent::psi|m</VAR><|
|00002070| 2f 41 3e 0a 6d 65 6d 62 | 65 72 20 70 6f 69 6e 74 |/A>.memb|er point|
|00002080| 65 72 2e 20 20 54 68 65 | 73 65 20 65 6e 76 69 72 |er. The|se envir|
|00002090| 6f 6e 6d 65 6e 74 20 61 | 6e 64 20 73 69 6d 75 6c |onment a|nd simul|
|000020a0| 61 74 69 6f 6e 20 61 72 | 65 20 62 6f 74 68 0a 67 |ation ar|e both.g|
|000020b0| 75 61 72 61 6e 74 65 65 | 64 20 74 6f 20 62 65 20 |uarantee|d to be |
|000020c0| 65 78 69 73 74 61 6e 74 | 20 61 6e 64 20 69 6e 69 |existant| and ini|
|000020d0| 74 65 64 20 62 79 20 74 | 68 65 20 74 69 6d 65 0a |ted by t|he time.|
|000020e0| 3c 43 4f 44 45 3e 41 67 | 65 6e 74 3a 3a 69 6e 69 |<CODE>Ag|ent::ini|
|000020f0| 74 3c 2f 43 4f 44 45 3e | 20 69 73 20 63 61 6c 6c |t</CODE>| is call|
|00002100| 65 64 2e 0a 0a 3c 50 3e | 0a 3c 41 20 4e 41 4d 45 |ed...<P>|.<A NAME|
|00002110| 3d 22 41 67 65 6e 74 3a | 3a 73 74 61 72 74 5f 74 |="Agent:|:start_t|
|00002120| 72 69 61 6c 22 3e 0a 3c | 44 49 56 20 41 4c 49 47 |rial">.<|DIV ALIG|
|00002130| 4e 3d 52 49 47 48 54 3e | 0a 5b 3c 41 20 48 52 45 |N=RIGHT>|.[<A HRE|
|00002140| 46 3d 22 72 6c 69 2e 68 | 2e 68 74 6d 6c 23 41 67 |F="rli.h|.html#Ag|
|00002150| 65 6e 74 22 3e 70 75 72 | 65 20 76 69 72 74 75 61 |ent">pur|e virtua|
|00002160| 6c 20 66 75 6e 63 74 69 | 6f 6e 3c 2f 41 3e 5d 0a |l functi|on</A>].|
|00002170| 3c 2f 44 49 56 3e 20 0a | 3c 2f 41 3e 0a 3c 54 54 |</DIV> .|</A>.<TT|
|00002180| 3e 0a 41 63 74 69 6f 6e | 2a 20 3c 42 3e 3c 43 4f |>.Action|* <B><CO|
|00002190| 44 45 3e 41 67 65 6e 74 | 3a 3a 73 74 61 72 74 5f |DE>Agent|::start_|
|000021a0| 74 72 69 61 6c 3c 2f 43 | 4f 44 45 3e 3c 2f 42 3e |trial</C|ODE></B>|
|000021b0| 0a 28 20 63 6f 6e 73 74 | 20 53 65 6e 73 61 74 69 |.( const| Sensati|
|000021c0| 6f 6e 2a 20 3c 56 41 52 | 3e 70 73 3c 2f 56 41 52 |on* <VAR|>ps</VAR|
|000021d0| 3e 29 0a 3c 2f 54 54 3e | 0a 0a 3c 50 3e 20 54 68 |>).</TT>|..<P> Th|
|000021e0| 69 73 20 66 75 6e 63 74 | 69 6f 6e 20 69 73 20 75 |is funct|ion is u|
|000021f0| 73 75 61 6c 6c 79 20 70 | 72 6f 76 69 64 65 64 20 |sually p|rovided |
|00002200| 62 79 20 74 68 65 20 75 | 73 65 72 20 66 6f 72 20 |by the u|ser for |
|00002210| 68 65 72 20 73 70 65 63 | 69 61 6c 69 7a 65 64 0a |her spec|ialized.|
|00002220| 61 67 65 6e 74 20 63 6c | 61 73 73 2e 20 20 49 74 |agent cl|ass. It|
|00002230| 20 69 73 20 63 61 6c 6c | 65 64 20 61 74 20 74 68 | is call|ed at th|
|00002240| 65 20 62 65 67 69 6e 6e | 69 6e 67 20 6f 66 20 65 |e beginn|ing of e|
|00002250| 61 63 68 20 6e 65 77 20 | 74 72 69 61 6c 2e 0a 3c |ach new |trial..<|
|00002260| 43 4f 44 45 3e 41 67 65 | 6e 74 3a 3a 73 74 61 72 |CODE>Age|nt::star|
|00002270| 74 5f 74 72 69 61 6c 3c | 2f 43 4f 44 45 3e 20 73 |t_trial<|/CODE> s|
|00002280| 68 6f 75 6c 64 20 70 65 | 72 66 6f 72 6d 20 61 6e |hould pe|rform an|
|00002290| 79 20 6e 65 65 64 65 64 | 0a 69 6e 69 74 69 61 6c |y needed|.initial|
|000022a0| 69 7a 61 74 69 6f 6e 20 | 6f 66 20 74 68 65 20 61 |ization |of the a|
|000022b0| 67 65 6e 74 20 74 6f 20 | 70 72 65 70 61 72 65 20 |gent to |prepare |
|000022c0| 69 74 20 66 6f 72 20 62 | 65 67 69 6e 6e 69 6e 67 |it for b|eginning|
|000022d0| 20 61 20 6e 65 77 20 74 | 72 69 61 6c 2e 0a 49 74 | a new t|rial..It|
|000022e0| 20 73 68 6f 75 6c 64 20 | 72 65 74 75 72 6e 20 61 | should |return a|
|000022f0| 20 70 6f 69 6e 74 65 72 | 20 74 6f 20 74 68 65 20 | pointer| to the |
|00002300| 66 69 72 73 74 20 61 63 | 74 69 6f 6e 20 6f 66 20 |first ac|tion of |
|00002310| 74 68 65 20 61 67 65 6e | 74 20 69 6e 20 74 68 65 |the agen|t in the|
|00002320| 20 6e 65 77 0a 74 72 69 | 61 6c 2c 20 69 6e 20 72 | new.tri|al, in r|
|00002330| 65 73 70 6f 6e 73 65 20 | 74 6f 20 3c 56 41 52 3e |esponse |to <VAR>|
|00002340| 70 73 3c 2f 56 41 52 3e | 20 28 61 20 70 6f 69 6e |ps</VAR>| (a poin|
|00002350| 74 65 72 20 74 6f 20 74 | 68 65 20 66 69 72 73 74 |ter to t|he first|
|00002360| 20 73 65 6e 73 61 74 69 | 6f 6e 0a 6f 66 20 74 68 | sensati|on.of th|
|00002370| 65 20 74 72 69 61 6c 29 | 2e 20 20 41 6c 73 6f 2c |e trial)|. Also,|
|00002380| 20 74 68 65 20 61 67 65 | 6e 74 20 69 6e 73 74 61 | the age|nt insta|
|00002390| 6e 63 65 20 73 68 6f 75 | 6c 64 20 70 72 6f 76 69 |nce shou|ld provi|
|000023a0| 64 65 20 74 68 65 20 73 | 70 61 63 65 20 69 6e 0a |de the s|pace in.|
|000023b0| 6d 65 6d 6f 72 79 20 77 | 68 65 72 65 20 74 68 65 |memory w|here the|
|000023c0| 20 61 63 74 69 6f 6e 20 | 69 73 20 73 74 6f 72 65 | action |is store|
|000023d0| 64 2c 20 77 68 69 63 68 | 20 73 68 6f 75 6c 64 20 |d, which| should |
|000023e0| 70 65 72 73 69 73 74 20 | 61 66 74 65 72 20 74 68 |persist |after th|
|000023f0| 65 0a 66 75 6e 63 74 69 | 6f 6e 20 69 73 20 63 61 |e.functi|on is ca|
|00002400| 6c 6c 65 64 2e 20 4d 65 | 6d 6f 72 79 20 61 6c 6c |lled. Me|mory all|
|00002410| 6f 63 61 74 69 6f 6e 20 | 73 68 6f 75 6c 64 20 62 |ocation |should b|
|00002420| 65 20 64 6f 6e 65 20 77 | 69 74 68 20 74 68 65 0a |e done w|ith the.|
|00002430| 3c 43 4f 44 45 3e 6e 65 | 77 3c 2f 43 4f 44 45 3e |<CODE>ne|w</CODE>|
|00002440| 20 63 6f 6e 73 74 72 75 | 63 74 6f 72 2c 20 74 68 | constru|ctor, th|
|00002450| 65 20 73 69 6d 75 6c 61 | 74 6f 72 20 74 61 6b 65 |e simula|tor take|
|00002460| 73 20 74 68 65 20 72 65 | 73 70 6f 6e 73 69 62 69 |s the re|sponsibi|
|00002470| 6c 69 74 79 0a 6f 66 20 | 66 72 65 65 69 6e 67 20 |lity.of |freeing |
|00002480| 74 68 65 20 6d 65 6d 6f | 72 79 20 77 69 74 68 20 |the memo|ry with |
|00002490| 3c 43 4f 44 45 3e 64 65 | 6c 65 74 65 3c 2f 43 4f |<CODE>de|lete</CO|
|000024a0| 44 45 3e 20 77 68 65 6e | 20 74 68 65 20 6f 62 6a |DE> when| the obj|
|000024b0| 65 63 74 20 69 73 20 6e | 6f 0a 6c 6f 6e 67 65 72 |ect is n|o.longer|
|000024c0| 20 6e 65 65 64 65 64 2e | 20 41 20 74 79 70 69 63 | needed.| A typic|
|000024d0| 61 6c 20 64 65 66 69 6e | 69 74 69 6f 6e 20 66 6f |al defin|ition fo|
|000024e0| 72 0a 3c 43 4f 44 45 3e | 41 67 65 6e 74 3a 3a 73 |r.<CODE>|Agent::s|
|000024f0| 74 61 72 74 5f 74 72 69 | 61 6c 3c 2f 43 4f 44 45 |tart_tri|al</CODE|
|00002500| 3e 20 69 73 3a 0a 0a 3c | 50 3e 3c 50 52 45 3e 0a |> is:..<|P><PRE>.|
|00002510| 41 63 74 69 6f 6e 20 2a | 3c 43 4f 44 45 3e 4d 79 |Action *|<CODE>My|
|00002520| 5f 41 67 65 6e 74 3a 3a | 73 74 61 72 74 5f 74 72 |_Agent::|start_tr|
|00002530| 69 61 6c 3c 2f 43 4f 44 | 45 3e 28 63 6f 6e 73 74 |ial</COD|E>(const|
|00002540| 20 53 65 6e 73 61 74 69 | 6f 6e 2a 20 3c 56 41 52 | Sensati|on* <VAR|
|00002550| 3e 70 73 3c 2f 56 41 52 | 3e 29 0a 7b 0a 20 20 20 |>ps</VAR|>).{. |
|00002560| 20 3c 49 3e 2f 2f 20 6d | 65 6d 6f 72 79 20 73 70 | <I>// m|emory sp|
|00002570| 61 63 65 20 74 6f 20 73 | 74 6f 72 65 20 74 68 65 |ace to s|tore the|
|00002580| 20 76 61 6c 75 65 20 6f | 66 20 61 6e 20 61 63 74 | value o|f an act|
|00002590| 69 6f 6e 3c 2f 49 3e 0a | 0a 20 20 20 20 4d 79 5f |ion</I>.|. My_|
|000025a0| 61 63 74 69 6f 6e 2a 20 | 3c 56 41 52 3e 70 61 3c |action* |<VAR>pa<|
|000025b0| 2f 56 41 52 3e 20 3d 20 | 6e 65 77 20 3c 43 4f 44 |/VAR> = |new <COD|
|000025c0| 45 3e 4d 79 5f 61 63 74 | 69 6f 6e 3c 2f 43 4f 44 |E>My_act|ion</COD|
|000025d0| 45 3e 3b 20 0a 0a 20 20 | 20 20 3c 49 3e 2f 2f 20 |E>; .. | <I>// |
|000025e0| 3c 43 4f 44 45 3e 70 6f | 6c 69 63 79 28 29 3c 2f |<CODE>po|licy()</|
|000025f0| 43 4f 44 45 3e 20 69 73 | 20 61 20 66 75 6e 63 74 |CODE> is| a funct|
|00002600| 69 6f 6e 20 74 68 61 74 | 20 73 74 6f 72 65 73 20 |ion that| stores |
|00002610| 74 68 65 20 76 61 6c 75 | 65 0a 20 20 20 20 2f 2f |the valu|e. //|
|00002620| 20 6f 66 20 74 68 65 20 | 61 63 74 69 6f 6e 20 63 | of the |action c|
|00002630| 6f 72 72 65 73 70 6f 6e | 64 69 6e 67 20 74 6f 20 |orrespon|ding to |
|00002640| 3c 56 41 52 3e 70 73 3c | 2f 56 41 52 3e 20 69 6e |<VAR>ps<|/VAR> in|
|00002650| 20 3c 56 41 52 3e 70 61 | 3c 2f 56 41 52 3e 2e 20 | <VAR>pa|</VAR>. |
|00002660| 3c 2f 49 3e 0a 0a 20 20 | 20 20 70 6f 6c 69 63 79 |</I>.. | policy|
|00002670| 28 20 28 4d 79 5f 53 65 | 6e 73 61 74 69 6f 6e 20 |( (My_Se|nsation |
|00002680| 2a 29 3c 56 41 52 3e 70 | 73 3c 2f 56 41 52 3e 2c |*)<VAR>p|s</VAR>,|
|00002690| 20 3c 56 41 52 3e 70 61 | 3c 2f 56 41 52 3e 20 29 | <VAR>pa|</VAR> )|
|000026a0| 3b 0a 0a 20 20 20 20 72 | 65 74 75 72 6e 20 3c 56 |;.. r|eturn <V|
|000026b0| 41 52 3e 70 61 3c 2f 56 | 41 52 3e 3b 0a 7d 0a 3c |AR>pa</V|AR>;.}.<|
|000026c0| 2f 50 52 45 3e 0a 0a 3c | 50 3e 77 68 65 72 65 20 |/PRE>..<|P>where |
|000026d0| 3c 43 4f 44 45 3e 70 6f | 6c 69 63 79 28 29 3c 2f |<CODE>po|licy()</|
|000026e0| 43 4f 44 45 3e 20 69 73 | 20 61 20 66 75 6e 63 74 |CODE> is| a funct|
|000026f0| 69 6f 6e 20 74 68 61 74 | 20 69 6d 70 6c 65 6d 65 |ion that| impleme|
|00002700| 6e 74 73 20 74 68 65 0a | 64 65 63 69 73 69 6f 6e |nts the.|decision|
|00002710| 2d 6d 61 6b 69 6e 67 20 | 70 6f 6c 69 63 79 20 6f |-making |policy o|
|00002720| 66 20 74 68 65 20 61 67 | 65 6e 74 2e 0a 0a 3c 50 |f the ag|ent...<P|
|00002730| 3e 0a 3c 41 20 4e 41 4d | 45 3d 22 41 67 65 6e 74 |>.<A NAM|E="Agent|
|00002740| 3a 3a 73 74 65 70 22 3e | 0a 3c 44 49 56 20 41 4c |::step">|.<DIV AL|
|00002750| 49 47 4e 3d 52 49 47 48 | 54 3e 0a 5b 3c 41 20 48 |IGN=RIGH|T>.[<A H|
|00002760| 52 45 46 3d 22 72 6c 69 | 2e 68 2e 68 74 6d 6c 23 |REF="rli|.h.html#|
|00002770| 41 67 65 6e 74 22 3e 70 | 75 72 65 20 76 69 72 74 |Agent">p|ure virt|
|00002780| 75 61 6c 20 66 75 6e 63 | 74 69 6f 6e 3c 2f 41 3e |ual func|tion</A>|
|00002790| 5d 0a 3c 2f 44 49 56 3e | 20 0a 3c 2f 41 3e 0a 3c |].</DIV>| .</A>.<|
|000027a0| 54 54 3e 0a 41 63 74 69 | 6f 6e 2a 20 3c 42 3e 3c |TT>.Acti|on* <B><|
|000027b0| 43 4f 44 45 3e 41 67 65 | 6e 74 3a 3a 73 74 65 70 |CODE>Age|nt::step|
|000027c0| 3c 2f 43 4f 44 45 3e 3c | 2f 42 3e 0a 28 20 63 6f |</CODE><|/B>.( co|
|000027d0| 6e 73 74 20 53 65 6e 73 | 61 74 69 6f 6e 2a 20 3c |nst Sens|ation* <|
|000027e0| 56 41 52 3e 70 6e 65 78 | 74 5f 73 3c 2f 56 41 52 |VAR>pnex|t_s</VAR|
|000027f0| 3e 2c 0a 20 20 64 6f 75 | 62 6c 65 20 3c 56 41 52 |>,. dou|ble <VAR|
|00002800| 3e 72 65 77 61 72 64 3c | 2f 56 41 52 3e 20 29 0a |>reward<|/VAR> ).|
|00002810| 3c 2f 54 54 3e 0a 0a 3c | 50 3e 20 54 68 69 73 20 |</TT>..<|P> This |
|00002820| 69 73 20 74 68 65 20 6d | 61 69 6e 20 66 75 6e 63 |is the m|ain func|
|00002830| 74 69 6f 6e 20 66 6f 72 | 20 3c 43 4f 44 45 3e 41 |tion for| <CODE>A|
|00002840| 67 65 6e 74 3c 2f 43 4f | 44 45 3e 2c 20 77 68 65 |gent</CO|DE>, whe|
|00002850| 72 65 20 61 6c 6c 20 74 | 68 65 0a 6c 65 61 72 6e |re all t|he.learn|
|00002860| 69 6e 67 20 74 61 6b 65 | 73 20 70 6c 61 63 65 2e |ing take|s place.|
|00002870| 20 20 49 74 20 6d 75 73 | 74 20 62 65 20 70 72 6f | It mus|t be pro|
|00002880| 76 69 64 65 64 20 62 79 | 20 74 68 65 20 75 73 65 |vided by| the use|
|00002890| 72 20 61 6e 64 20 77 69 | 6c 6c 20 62 65 0a 63 61 |r and wi|ll be.ca|
|000028a0| 6c 6c 65 64 20 6f 6e 63 | 65 20 62 79 20 74 68 65 |lled onc|e by the|
|000028b0| 20 73 69 6d 75 6c 61 74 | 69 6f 6e 20 69 6e 73 74 | simulat|ion inst|
|000028c0| 61 6e 63 65 20 6f 6e 20 | 65 61 63 68 20 73 74 65 |ance on |each ste|
|000028d0| 70 20 6f 66 20 74 68 65 | 20 73 69 6d 75 6c 61 74 |p of the| simulat|
|000028e0| 69 6f 6e 2e 0a 3c 43 4f | 44 45 3e 41 67 65 6e 74 |ion..<CO|DE>Agent|
|000028f0| 3a 3a 73 74 65 70 3c 2f | 43 4f 44 45 3e 20 69 6e |::step</|CODE> in|
|00002900| 66 6f 72 6d 73 20 74 68 | 65 20 61 67 65 6e 74 20 |forms th|e agent |
|00002910| 74 68 61 74 2c 20 69 6e | 20 72 65 73 70 6f 6e 73 |that, in| respons|
|00002920| 65 20 74 6f 20 74 68 65 | 0a 69 74 73 20 70 72 65 |e to the|.its pre|
|00002930| 76 69 6f 75 73 6c 79 20 | 63 68 6f 73 65 6e 20 61 |viously |chosen a|
|00002940| 63 74 69 6f 6e 2c 20 74 | 68 65 20 65 6e 76 69 72 |ction, t|he envir|
|00002950| 6f 6e 6d 65 6e 74 20 72 | 65 74 75 72 6e 65 64 20 |onment r|eturned |
|00002960| 74 68 65 20 73 65 6e 73 | 61 74 69 6f 6e 0a 70 6f |the sens|ation.po|
|00002970| 69 6e 74 65 64 20 62 79 | 20 3c 56 41 52 3e 70 6e |inted by| <VAR>pn|
|00002980| 65 78 74 5f 73 3c 2f 56 | 41 52 3e 20 61 6e 64 20 |ext_s</V|AR> and |
|00002990| 74 68 65 20 70 61 79 6f | 66 66 20 69 6e 20 3c 56 |the payo|ff in <V|
|000029a0| 41 52 3e 72 65 77 61 72 | 64 3c 2f 56 41 52 3e 2e |AR>rewar|d</VAR>.|
|000029b0| 0a 54 68 65 20 61 67 65 | 6e 74 20 69 6e 73 74 61 |.The age|nt insta|
|000029c0| 6e 63 65 20 69 73 20 72 | 65 73 70 6f 6e 73 69 62 |nce is r|esponsib|
|000029d0| 6c 65 20 66 6f 72 20 72 | 65 6d 65 6d 62 65 72 69 |le for r|ememberi|
|000029e0| 6e 67 20 74 68 65 20 70 | 72 65 76 69 6f 75 73 0a |ng the p|revious.|
|000029f0| 73 65 6e 73 61 74 69 6f | 6e 20 61 6e 64 20 61 63 |sensatio|n and ac|
|00002a00| 74 69 6f 6e 20 69 6e 20 | 63 61 73 65 20 69 74 20 |tion in |case it |
|00002a10| 72 65 71 75 69 72 65 73 | 20 74 68 65 6d 20 66 6f |requires| them fo|
|00002a20| 72 20 6c 65 61 72 6e 69 | 6e 67 2e 20 20 46 6f 72 |r learni|ng. For|
|00002a30| 20 74 68 69 73 0a 74 6f | 20 77 6f 72 6b 2c 20 3c | this.to| work, <|
|00002a40| 63 6f 64 65 3e 41 67 65 | 6e 74 3a 3a 73 74 65 70 |code>Age|nt::step|
|00002a50| 3c 2f 63 6f 64 65 3e 20 | 6d 75 73 74 20 6e 65 76 |</code> |must nev|
|00002a60| 65 72 20 62 65 20 63 61 | 6c 6c 65 64 20 64 69 72 |er be ca|lled dir|
|00002a70| 65 63 74 6c 79 20 62 79 | 20 74 68 65 0a 75 73 65 |ectly by| the.use|
|00002a80| 72 2e 20 20 54 68 69 73 | 20 66 75 6e 63 74 69 6f |r. This| functio|
|00002a90| 6e 20 72 65 74 75 72 6e | 73 20 61 20 70 6f 69 6e |n return|s a poin|
|00002aa0| 74 65 72 20 74 6f 20 74 | 68 65 20 61 63 74 69 6f |ter to t|he actio|
|00002ab0| 6e 20 74 6f 20 62 65 20 | 74 61 6b 65 6e 20 69 6e |n to be |taken in|
|00002ac0| 0a 72 65 73 70 6f 6e 73 | 65 20 74 6f 20 74 68 65 |.respons|e to the|
|00002ad0| 20 73 65 6e 73 61 74 69 | 6f 6e 20 70 6f 69 6e 74 | sensati|on point|
|00002ae0| 65 64 20 62 79 20 3c 56 | 41 52 3e 70 6e 65 78 74 |ed by <V|AR>pnext|
|00002af0| 5f 73 3c 2f 56 41 52 3e | 2e 20 54 68 65 20 61 67 |_s</VAR>|. The ag|
|00002b00| 65 6e 74 0a 69 6e 73 74 | 61 6e 63 65 20 73 68 6f |ent.inst|ance sho|
|00002b10| 75 6c 64 20 70 72 6f 76 | 69 64 65 20 74 68 65 20 |uld prov|ide the |
|00002b20| 73 70 61 63 65 20 69 6e | 20 6d 65 6d 6f 72 79 20 |space in| memory |
|00002b30| 77 68 65 72 65 20 74 68 | 65 20 61 63 74 69 6f 6e |where th|e action|
|00002b40| 20 69 73 0a 73 74 6f 72 | 65 64 2c 20 77 68 69 63 | is.stor|ed, whic|
|00002b50| 68 20 73 68 6f 75 6c 64 | 20 70 65 72 73 69 73 74 |h should| persist|
|00002b60| 20 61 66 74 65 72 20 74 | 68 65 20 66 75 6e 63 74 | after t|he funct|
|00002b70| 69 6f 6e 20 69 73 20 63 | 61 6c 6c 65 64 2e 20 4d |ion is c|alled. M|
|00002b80| 65 6d 6f 72 79 0a 61 6c | 6c 6f 63 61 74 69 6f 6e |emory.al|location|
|00002b90| 20 73 68 6f 75 6c 64 20 | 62 65 20 64 6f 6e 65 20 | should |be done |
|00002ba0| 77 69 74 68 20 74 68 65 | 20 3c 43 4f 44 45 3e 6e |with the| <CODE>n|
|00002bb0| 65 77 3c 2f 43 4f 44 45 | 3e 20 63 6f 6e 73 74 72 |ew</CODE|> constr|
|00002bc0| 75 63 74 6f 72 2c 20 74 | 68 65 0a 73 69 6d 75 6c |uctor, t|he.simul|
|00002bd0| 61 74 6f 72 20 74 61 6b | 65 73 20 74 68 65 20 72 |ator tak|es the r|
|00002be0| 65 73 70 6f 6e 73 69 62 | 69 6c 69 74 79 20 6f 66 |esponsib|ility of|
|00002bf0| 20 66 72 65 65 69 6e 67 | 20 74 68 65 20 6d 65 6d | freeing| the mem|
|00002c00| 6f 72 79 20 77 69 74 68 | 0a 3c 43 4f 44 45 3e 64 |ory with|.<CODE>d|
|00002c10| 65 6c 65 74 65 3c 2f 43 | 4f 44 45 3e 20 77 68 65 |elete</C|ODE> whe|
|00002c20| 6e 20 74 68 65 20 6f 62 | 6a 65 63 74 20 69 73 20 |n the ob|ject is |
|00002c30| 6e 6f 20 6c 6f 6e 67 65 | 72 20 6e 65 65 64 65 64 |no longe|r needed|
|00002c40| 2e 0a 0a 3c 50 3e 20 49 | 6e 20 61 20 74 72 69 61 |...<P> I|n a tria|
|00002c50| 6c 2d 62 61 73 65 64 20 | 74 61 73 6b 2c 20 3c 56 |l-based |task, <V|
|00002c60| 41 52 3e 70 6e 65 78 74 | 5f 73 3c 2f 56 41 52 3e |AR>pnext|_s</VAR>|
|00002c70| 20 6d 61 79 0a 74 61 6b | 65 20 6f 6e 20 74 68 65 | may.tak|e on the|
|00002c80| 20 73 70 65 63 69 61 6c | 20 76 61 6c 75 65 20 3c | special| value <|
|00002c90| 43 4f 44 45 3e 30 3c 2f | 43 4f 44 45 3e 2c 20 69 |CODE>0</|CODE>, i|
|00002ca0| 6e 64 69 63 61 74 69 6e | 67 20 74 68 61 74 20 74 |ndicatin|g that t|
|00002cb0| 68 65 20 74 72 69 61 6c | 0a 68 61 73 20 74 65 72 |he trial|.has ter|
|00002cc0| 6d 69 6e 61 74 65 64 20 | 77 69 74 68 20 74 68 69 |minated |with thi|
|00002cd0| 73 20 73 74 65 70 2e 20 | 20 54 68 65 20 61 75 74 |s step. | The aut|
|00002ce0| 68 6f 72 20 6f 66 0a 3c | 43 4f 44 45 3e 41 67 65 |hor of.<|CODE>Age|
|00002cf0| 6e 74 3a 3a 73 74 65 70 | 3c 2f 43 4f 44 45 3e 20 |nt::step|</CODE> |
|00002d00| 69 73 20 72 65 73 70 6f | 6e 73 69 62 6c 65 20 66 |is respo|nsible f|
|00002d10| 6f 72 20 63 68 65 63 6b | 69 6e 67 20 66 6f 72 20 |or check|ing for |
|00002d20| 74 68 69 73 20 61 6e 64 | 0a 61 64 6a 75 73 74 69 |this and|.adjusti|
|00002d30| 6e 67 20 69 74 73 20 6c | 65 61 72 6e 69 6e 67 20 |ng its l|earning |
|00002d40| 61 6e 64 20 6f 74 68 65 | 72 20 70 72 6f 63 65 73 |and othe|r proces|
|00002d50| 73 65 73 20 61 63 63 6f | 72 64 69 6e 67 6c 79 2e |ses acco|rdingly.|
|00002d60| 20 20 49 6e 20 74 68 69 | 73 20 63 61 73 65 2c 0a | In thi|s case,.|
|00002d70| 74 68 65 20 76 61 6c 75 | 65 20 72 65 74 75 72 6e |the valu|e return|
|00002d80| 65 64 20 66 72 6f 6d 20 | 3c 43 4f 44 45 3e 41 67 |ed from |<CODE>Ag|
|00002d90| 65 6e 74 3a 3a 73 74 65 | 70 3c 2f 43 4f 44 45 3e |ent::ste|p</CODE>|
|00002da0| 20 77 69 6c 6c 20 62 65 | 20 69 67 6e 6f 72 65 64 | will be| ignored|
|00002db0| 2e 0a 0a 0a 3c 48 52 3e | 0a 0a 3c 41 20 4e 41 4d |....<HR>|..<A NAM|
|00002dc0| 45 3d 22 45 6e 76 69 72 | 6f 6e 6d 65 6e 74 22 3e |E="Envir|onment">|
|00002dd0| 0a 3c 48 32 3e 45 6e 76 | 69 72 6f 6e 6d 65 6e 74 |.<H2>Env|ironment|
|00002de0| 3c 2f 48 32 3e 0a 3c 2f | 41 3e 20 0a 0a 3c 50 3e |</H2>.</|A> ..<P>|
|00002df0| 20 54 68 65 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 | The env|ironment|
|00002e00| 20 62 61 73 69 63 61 6c | 6c 79 20 64 65 66 69 6e | basical|ly defin|
|00002e10| 65 73 20 74 68 65 20 70 | 72 6f 62 6c 65 6d 20 74 |es the p|roblem t|
|00002e20| 6f 20 62 65 20 73 6f 6c | 76 65 64 2e 20 20 49 74 |o be sol|ved. It|
|00002e30| 0a 64 65 74 65 72 6d 69 | 6e 65 73 20 74 68 65 20 |.determi|nes the |
|00002e40| 64 79 6e 61 6d 69 63 73 | 20 6f 66 20 74 68 65 20 |dynamics| of the |
|00002e50| 65 6e 76 69 72 6f 6e 6d | 65 6e 74 2c 20 74 68 65 |environm|ent, the|
|00002e60| 20 72 65 77 61 72 64 73 | 2c 20 61 6e 64 20 74 68 | rewards|, and th|
|00002e70| 65 20 74 72 69 61 6c 0a | 74 65 72 6d 69 6e 61 74 |e trial.|terminat|
|00002e80| 69 6f 6e 73 2e 0a 0a 3c | 50 3e 3c 44 49 56 20 41 |ions...<|P><DIV A|
|00002e90| 4c 49 47 4e 3d 52 49 47 | 48 54 3e 0a 5b 3c 41 20 |LIGN=RIG|HT>.[<A |
|00002ea0| 48 52 45 46 3d 22 72 6c | 69 2e 68 2e 68 74 6d 6c |HREF="rl|i.h.html|
|00002eb0| 23 45 6e 76 69 72 6f 6e | 6d 65 6e 74 22 3e 61 62 |#Environ|ment">ab|
|00002ec0| 73 74 72 61 63 74 20 63 | 6c 61 73 73 3c 2f 41 3e |stract c|lass</A>|
|00002ed0| 5d 0a 3c 2f 44 49 56 3e | 20 0a 3c 54 54 3e 3c 42 |].</DIV>| .<TT><B|
|00002ee0| 3e 3c 43 4f 44 45 3e 45 | 6e 76 69 72 6f 6e 6d 65 |><CODE>E|nvironme|
|00002ef0| 6e 74 3c 2f 43 4f 44 45 | 3e 3c 2f 42 3e 3c 2f 54 |nt</CODE|></B></T|
|00002f00| 54 3e 0a 0a 3c 50 3e 54 | 68 65 20 62 61 73 65 20 |T>..<P>T|he base |
|00002f10| 63 6c 61 73 73 20 6f 66 | 20 61 6c 6c 20 65 6e 76 |class of| all env|
|00002f20| 69 72 6f 6e 6d 65 6e 74 | 73 2e 20 20 53 70 65 63 |ironment|s. Spec|
|00002f30| 69 66 69 63 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 |ific env|ironment|
|00002f40| 73 20 61 72 65 0a 69 6e | 73 74 61 6e 63 65 73 20 |s are.in|stances |
|00002f50| 6f 66 20 73 75 62 63 6c | 61 73 73 65 73 20 64 65 |of subcl|asses de|
|00002f60| 72 69 76 65 64 20 66 72 | 6f 6d 20 3c 43 4f 44 45 |rived fr|om <CODE|
|00002f70| 3e 45 6e 76 69 72 6f 6e | 6d 65 6e 74 3c 2f 43 4f |>Environ|ment</CO|
|00002f80| 44 45 3e 2e 20 55 73 65 | 72 0a 64 65 66 69 6e 65 |DE>. Use|r.define|
|00002f90| 64 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 20 63 6c |d enviro|nment cl|
|00002fa0| 61 73 73 65 73 20 28 73 | 75 62 63 6c 61 73 73 65 |asses (s|ubclasse|
|00002fb0| 73 20 6f 66 20 3c 43 4f | 44 45 3e 45 6e 76 69 72 |s of <CO|DE>Envir|
|00002fc0| 6f 6e 6d 65 6e 74 3c 2f | 43 4f 44 45 3e 29 0a 77 |onment</|CODE>).w|
|00002fd0| 69 6c 6c 20 6e 6f 72 6d | 61 6c 6c 79 20 70 72 6f |ill norm|ally pro|
|00002fe0| 76 69 64 65 20 73 70 65 | 63 69 61 6c 69 7a 65 64 |vide spe|cialized|
|00002ff0| 20 64 65 66 69 6e 69 74 | 69 6f 6e 73 20 6f 66 20 | definit|ions of |
|00003000| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 74 68 |the foll|owing th|
|00003010| 72 65 65 0a 66 75 6e 63 | 74 69 6f 6e 73 2e 0a 0a |ree.func|tions...|
|00003020| 3c 50 3e 0a 3c 41 20 4e | 41 4d 45 3d 22 45 6e 76 |<P>.<A N|AME="Env|
|00003030| 69 72 6f 6e 6d 65 6e 74 | 3a 3a 69 6e 69 74 22 3e |ironment|::init">|
|00003040| 0a 3c 44 49 56 20 41 4c | 49 47 4e 3d 52 49 47 48 |.<DIV AL|IGN=RIGH|
|00003050| 54 3e 0a 5b 3c 41 20 48 | 52 45 46 3d 22 72 6c 69 |T>.[<A H|REF="rli|
|00003060| 2e 63 63 2e 68 74 6d 6c | 23 45 6e 76 69 72 6f 6e |.cc.html|#Environ|
|00003070| 6d 65 6e 74 3a 3a 69 6e | 69 74 22 3e 76 69 72 74 |ment::in|it">virt|
|00003080| 75 61 6c 20 66 75 6e 63 | 74 69 6f 6e 3c 2f 41 3e |ual func|tion</A>|
|00003090| 5d 0a 3c 2f 44 49 56 3e | 20 0a 3c 2f 41 3e 0a 3c |].</DIV>| .</A>.<|
|000030a0| 54 54 3e 0a 76 6f 69 64 | 20 3c 42 3e 3c 43 4f 44 |TT>.void| <B><COD|
|000030b0| 45 3e 45 6e 76 69 72 6f | 6e 6d 65 6e 74 3a 3a 69 |E>Enviro|nment::i|
|000030c0| 6e 69 74 3c 2f 43 4f 44 | 45 3e 3c 2f 42 3e 0a 28 |nit</COD|E></B>.(|
|000030d0| 20 69 6e 74 20 3c 56 41 | 52 3e 61 72 67 63 3c 2f | int <VA|R>argc</|
|000030e0| 56 41 52 3e 2c 20 63 68 | 61 72 20 2a 3c 56 41 52 |VAR>, ch|ar *<VAR|
|000030f0| 3e 61 72 67 76 3c 2f 56 | 41 52 3e 5b 5d 20 29 0a |>argv</V|AR>[] ).|
|00003100| 3c 2f 54 54 3e 0a 0a 3c | 50 3e 20 54 68 69 73 20 |</TT>..<|P> This |
|00003110| 66 75 6e 63 74 69 6f 6e | 20 69 73 20 6e 6f 72 6d |function| is norm|
|00003120| 61 6c 6c 79 20 70 72 6f | 76 69 64 65 64 20 62 79 |ally pro|vided by|
|00003130| 20 74 68 65 20 75 73 65 | 72 20 66 6f 72 20 68 65 | the use|r for he|
|00003140| 72 20 73 70 65 63 69 61 | 6c 69 7a 65 64 0a 65 6e |r specia|lized.en|
|00003150| 76 69 72 6f 6e 6d 65 6e | 74 20 63 6c 61 73 73 2e |vironmen|t class.|
|00003160| 20 20 3c 43 4f 44 45 3e | 45 6e 76 69 72 6f 6e 6d | <CODE>|Environm|
|00003170| 65 6e 74 3a 3a 69 6e 69 | 74 3c 2f 43 4f 44 45 3e |ent::ini|t</CODE>|
|00003180| 20 73 68 6f 75 6c 64 20 | 69 6e 69 74 69 61 6c 69 | should |initiali|
|00003190| 7a 65 0a 74 68 65 20 69 | 6e 73 74 61 6e 63 65 20 |ze.the i|nstance |
|000031a0| 6f 66 20 74 68 65 20 65 | 6e 76 69 72 6f 6e 6d 65 |of the e|nvironme|
|000031b0| 6e 74 2c 20 6d 61 6b 69 | 6e 67 20 61 6e 79 20 6e |nt, maki|ng any n|
|000031c0| 65 65 64 65 64 20 64 61 | 74 61 2d 73 74 72 75 63 |eeded da|ta-struc|
|000031d0| 74 75 72 65 73 2e 0a 49 | 66 20 74 68 65 20 65 6e |tures..I|f the en|
|000031e0| 76 69 72 6f 6e 6d 65 6e | 74 20 63 68 61 6e 67 65 |vironmen|t change|
|000031f0| 73 20 69 6e 20 61 6e 79 | 20 77 61 79 20 77 69 74 |s in any| way wit|
|00003200| 68 20 65 78 70 65 72 69 | 65 6e 63 65 2c 20 74 68 |h experi|ence, th|
|00003210| 65 6e 20 74 68 69 73 0a | 66 75 6e 63 74 69 6f 6e |en this.|function|
|00003220| 20 73 68 6f 75 6c 64 20 | 72 65 73 65 74 20 69 74 | should |reset it|
|00003230| 20 74 6f 20 69 74 73 20 | 6f 72 69 67 69 6e 61 6c | to its |original|
|00003240| 2c 20 6e 61 69 76 65 20 | 63 6f 6e 64 69 74 69 6f |, naive |conditio|
|00003250| 6e 2e 20 20 54 68 65 20 | 69 6e 70 75 74 0a 61 72 |n. The |input.ar|
|00003260| 67 75 6d 65 6e 74 73 20 | 70 72 6f 76 69 64 65 20 |guments |provide |
|00003270| 74 68 65 20 67 65 6e 65 | 72 69 63 20 63 6f 6d 6d |the gene|ric comm|
|00003280| 61 6e 64 2d 6c 69 6e 65 | 20 69 6e 69 74 69 61 6c |and-line| initial|
|00003290| 69 7a 61 74 69 6f 6e 20 | 70 61 72 61 6d 65 74 65 |ization |paramete|
|000032a0| 72 73 0a 75 73 69 6e 67 | 20 74 68 65 20 73 74 61 |rs.using| the sta|
|000032b0| 6e 64 61 72 64 20 66 6f | 72 6d 61 74 20 28 69 2e |ndard fo|rmat (i.|
|000032c0| 65 2e 2c 20 3c 56 41 52 | 3e 61 72 67 63 3c 2f 56 |e., <VAR|>argc</V|
|000032d0| 41 52 3e 20 69 73 20 74 | 68 65 20 6e 75 6d 62 65 |AR> is t|he numbe|
|000032e0| 72 20 6f 66 0a 63 6f 6d | 6d 61 6e 64 2d 6c 69 6e |r of.com|mand-lin|
|000032f0| 65 20 70 61 72 61 6d 65 | 74 65 72 73 20 61 6e 64 |e parame|ters and|
|00003300| 20 3c 56 41 52 3e 61 72 | 67 76 3c 2f 56 41 52 3e | <VAR>ar|gv</VAR>|
|00003310| 20 69 73 20 74 68 65 20 | 61 72 72 61 79 20 6f 66 | is the |array of|
|00003320| 20 70 6f 69 6e 74 65 72 | 73 0a 74 6f 20 73 74 72 | pointer|s.to str|
|00003330| 69 6e 67 73 29 2e 20 4e | 6f 72 6d 61 6c 6c 79 2c |ings). N|ormally,|
|00003340| 20 3c 43 4f 44 45 3e 45 | 6e 76 69 72 6f 6e 6d 65 | <CODE>E|nvironme|
|00003350| 6e 74 3a 3a 69 6e 69 74 | 3c 2f 43 4f 44 45 3e 20 |nt::init|</CODE> |
|00003360| 69 73 20 63 61 6c 6c 65 | 64 20 6f 6e 63 65 0a 77 |is calle|d once.w|
|00003370| 68 65 6e 20 74 68 65 20 | 73 69 6d 75 6c 61 74 69 |hen the |simulati|
|00003380| 6f 6e 20 69 73 20 66 69 | 72 73 74 20 61 73 73 65 |on is fi|rst asse|
|00003390| 6d 62 6c 65 64 20 61 6e | 64 20 69 6e 69 74 69 61 |mbled an|d initia|
|000033a0| 6c 69 7a 65 64 2e 20 20 | 54 68 65 20 64 65 66 61 |lized. |The defa|
|000033b0| 75 6c 74 0a 6d 65 74 68 | 6f 64 20 66 6f 72 20 3c |ult.meth|od for <|
|000033c0| 43 4f 44 45 3e 45 6e 76 | 69 72 6f 6e 6d 65 6e 74 |CODE>Env|ironment|
|000033d0| 3a 3a 69 6e 69 74 3c 2f | 43 4f 44 45 3e 20 64 6f |::init</|CODE> do|
|000033e0| 65 73 20 6e 6f 74 68 69 | 6e 67 2e 0a 0a 3c 50 3e |es nothi|ng...<P>|
|000033f0| 49 66 20 6e 65 65 64 65 | 64 2c 20 74 68 65 20 65 |If neede|d, the e|
|00003400| 6e 76 69 72 6f 6e 6d 65 | 6e 74 20 63 61 6e 20 63 |nvironme|nt can c|
|00003410| 6f 6e 73 75 6c 74 20 77 | 69 74 68 20 74 68 65 20 |onsult w|ith the |
|00003420| 73 69 6d 75 6c 61 74 69 | 6f 6e 20 61 73 20 70 61 |simulati|on as pa|
|00003430| 72 74 0a 6f 66 20 73 65 | 74 74 69 6e 67 20 75 70 |rt.of se|tting up|
|00003440| 20 69 74 73 20 69 6e 69 | 74 69 61 6c 69 7a 61 74 | its ini|tializat|
|00003450| 69 6f 6e 2e 20 20 54 68 | 65 20 65 6e 76 69 72 6f |ion. Th|e enviro|
|00003460| 6e 6d 65 6e 74 20 63 61 | 6e 20 61 63 63 65 73 73 |nment ca|n access|
|00003470| 20 74 68 65 0a 73 69 6d | 75 6c 61 74 69 6f 6e 20 | the.sim|ulation |
|00003480| 62 79 20 61 63 63 65 73 | 73 69 6e 67 20 74 68 65 |by acces|sing the|
|00003490| 20 3c 41 0a 48 52 45 46 | 3d 22 23 63 72 6f 73 73 | <A.HREF|="#cross|
|000034a0| 2d 72 65 66 65 72 65 6e | 63 65 22 3e 3c 56 41 52 |-referen|ce"><VAR|
|000034b0| 3e 45 6e 76 69 72 6f 6e | 6d 65 6e 74 3a 3a 70 73 |>Environ|ment::ps|
|000034c0| 69 6d 3c 2f 56 41 52 3e | 3c 2f 41 3e 20 6d 65 6d |im</VAR>|</A> mem|
|000034d0| 62 65 72 0a 70 6f 69 6e | 74 65 72 2e 20 20 54 68 |ber.poin|ter. Th|
|000034e0| 65 20 63 6f 72 72 65 73 | 70 6f 6e 64 69 6e 67 20 |e corres|ponding |
|000034f0| 61 67 65 6e 74 20 69 73 | 20 3c 65 6d 3e 6e 6f 74 |agent is| <em>not|
|00003500| 3c 2f 65 6d 3e 20 61 76 | 61 69 6c 61 62 6c 65 20 |</em> av|ailable |
|00003510| 61 74 20 74 68 65 0a 74 | 69 6d 65 20 3c 43 4f 44 |at the.t|ime <COD|
|00003520| 45 3e 45 6e 76 69 72 6f | 6e 6d 65 6e 74 3a 3a 69 |E>Enviro|nment::i|
|00003530| 6e 69 74 3c 2f 43 4f 44 | 45 3e 20 69 73 20 63 61 |nit</COD|E> is ca|
|00003540| 6c 6c 65 64 2e 0a 0a 3c | 50 3e 0a 3c 41 20 4e 41 |lled...<|P>.<A NA|
|00003550| 4d 45 3d 22 45 6e 76 69 | 72 6f 6e 6d 65 6e 74 3a |ME="Envi|ronment:|
|00003560| 3a 73 74 61 72 74 5f 74 | 72 69 61 6c 22 3e 0a 3c |:start_t|rial">.<|
|00003570| 44 49 56 20 41 4c 49 47 | 4e 3d 52 49 47 48 54 3e |DIV ALIG|N=RIGHT>|
|00003580| 0a 5b 3c 41 20 48 52 45 | 46 3d 22 72 6c 69 2e 68 |.[<A HRE|F="rli.h|
|00003590| 2e 68 74 6d 6c 23 45 6e | 76 69 72 6f 6e 6d 65 6e |.html#En|vironmen|
|000035a0| 74 22 3e 70 75 72 65 20 | 76 69 72 74 75 61 6c 20 |t">pure |virtual |
|000035b0| 66 75 6e 63 74 69 6f 6e | 3c 2f 41 3e 5d 0a 3c 2f |function|</A>].</|
|000035c0| 44 49 56 3e 20 0a 3c 2f | 41 3e 0a 3c 54 54 3e 0a |DIV> .</|A>.<TT>.|
|000035d0| 53 65 6e 73 61 74 69 6f | 6e 2a 20 3c 42 3e 3c 43 |Sensatio|n* <B><C|
|000035e0| 4f 44 45 3e 45 6e 76 69 | 72 6f 6e 6d 65 6e 74 3a |ODE>Envi|ronment:|
|000035f0| 3a 73 74 61 72 74 5f 74 | 72 69 61 6c 3c 2f 43 4f |:start_t|rial</CO|
|00003600| 44 45 3e 3c 2f 42 3e 0a | 28 20 76 6f 69 64 20 29 |DE></B>.|( void )|
|00003610| 0a 3c 2f 54 54 3e 0a 0a | 3c 50 3e 20 54 68 69 73 |.</TT>..|<P> This|
|00003620| 20 66 75 6e 63 74 69 6f | 6e 20 6d 75 73 74 20 62 | functio|n must b|
|00003630| 65 20 70 72 6f 76 69 64 | 65 64 20 62 79 20 74 68 |e provid|ed by th|
|00003640| 65 20 75 73 65 72 20 66 | 6f 72 20 68 65 72 20 73 |e user f|or her s|
|00003650| 70 65 63 69 61 6c 69 7a | 65 64 0a 65 6e 76 69 72 |pecializ|ed.envir|
|00003660| 6f 6e 6d 65 6e 74 20 63 | 6c 61 73 73 2e 20 20 49 |onment c|lass. I|
|00003670| 74 20 69 73 20 6e 6f 72 | 6d 61 6c 6c 79 20 63 61 |t is nor|mally ca|
|00003680| 6c 6c 65 64 20 61 74 20 | 74 68 65 20 62 65 67 69 |lled at |the begi|
|00003690| 6e 6e 69 6e 67 20 6f 66 | 20 65 61 63 68 20 6e 65 |nning of| each ne|
|000036a0| 77 0a 74 72 69 61 6c 2e | 20 20 3c 43 4f 44 45 3e |w.trial.| <CODE>|
|000036b0| 45 6e 76 69 72 6f 6e 6d | 65 6e 74 3a 3a 73 74 61 |Environm|ent::sta|
|000036c0| 72 74 5f 74 72 69 61 6c | 3c 2f 43 4f 44 45 3e 20 |rt_trial|</CODE> |
|000036d0| 73 68 6f 75 6c 64 20 70 | 65 72 66 6f 72 6d 20 61 |should p|erform a|
|000036e0| 6e 79 0a 6e 65 65 64 65 | 64 20 69 6e 69 74 69 61 |ny.neede|d initia|
|000036f0| 6c 69 7a 61 74 69 6f 6e | 20 6f 66 20 74 68 65 20 |lization| of the |
|00003700| 65 6e 76 69 72 6f 6e 6d | 65 6e 74 20 74 6f 20 70 |environm|ent to p|
|00003710| 72 65 70 61 72 65 20 69 | 74 20 66 6f 72 20 62 65 |repare i|t for be|
|00003720| 67 69 6e 6e 69 6e 67 20 | 61 0a 6e 65 77 20 74 72 |ginning |a.new tr|
|00003730| 69 61 6c 2e 20 20 49 74 | 20 73 68 6f 75 6c 64 20 |ial. It| should |
|00003740| 72 65 74 75 72 6e 20 61 | 20 70 6f 69 6e 74 65 72 |return a| pointer|
|00003750| 20 74 6f 20 74 68 65 20 | 66 69 72 73 74 20 73 65 | to the |first se|
|00003760| 6e 73 61 74 69 6f 6e 20 | 6f 66 20 74 68 65 0a 74 |nsation |of the.t|
|00003770| 72 69 61 6c 2e 20 54 68 | 65 20 65 6e 76 69 72 6f |rial. Th|e enviro|
|00003780| 6e 6d 65 6e 74 20 69 6e | 73 74 61 6e 63 65 20 73 |nment in|stance s|
|00003790| 68 6f 75 6c 64 20 70 72 | 6f 76 69 64 65 20 74 68 |hould pr|ovide th|
|000037a0| 65 20 73 70 61 63 65 20 | 69 6e 20 6d 65 6d 6f 72 |e space |in memor|
|000037b0| 79 0a 77 68 65 72 65 20 | 74 68 65 20 73 65 6e 73 |y.where |the sens|
|000037c0| 61 74 69 6f 6e 20 69 73 | 20 73 74 6f 72 65 64 2c |ation is| stored,|
|000037d0| 20 77 68 69 63 68 20 73 | 68 6f 75 6c 64 20 70 65 | which s|hould pe|
|000037e0| 72 73 69 73 74 20 61 66 | 74 65 72 20 74 68 65 20 |rsist af|ter the |
|000037f0| 66 75 6e 63 74 69 6f 6e | 0a 69 73 20 63 61 6c 6c |function|.is call|
|00003800| 65 64 2e 20 4d 65 6d 6f | 72 79 20 61 6c 6c 6f 63 |ed. Memo|ry alloc|
|00003810| 61 74 69 6f 6e 20 73 68 | 6f 75 6c 64 20 62 65 20 |ation sh|ould be |
|00003820| 64 6f 6e 65 20 77 69 74 | 68 20 74 68 65 20 3c 43 |done wit|h the <C|
|00003830| 4f 44 45 3e 6e 65 77 3c | 2f 43 4f 44 45 3e 0a 63 |ODE>new<|/CODE>.c|
|00003840| 6f 6e 73 74 72 75 63 74 | 6f 72 2c 20 74 68 65 20 |onstruct|or, the |
|00003850| 73 69 6d 75 6c 61 74 6f | 72 20 74 61 6b 65 73 20 |simulato|r takes |
|00003860| 74 68 65 20 72 65 73 70 | 6f 6e 73 69 62 69 6c 69 |the resp|onsibili|
|00003870| 74 79 20 6f 66 20 66 72 | 65 65 69 6e 67 20 74 68 |ty of fr|eeing th|
|00003880| 65 0a 6d 65 6d 6f 72 79 | 20 77 69 74 68 20 3c 43 |e.memory| with <C|
|00003890| 4f 44 45 3e 64 65 6c 65 | 74 65 3c 2f 43 4f 44 45 |ODE>dele|te</CODE|
|000038a0| 3e 20 77 68 65 6e 20 74 | 68 65 20 6f 62 6a 65 63 |> when t|he objec|
|000038b0| 74 20 69 73 20 6e 6f 20 | 6c 6f 6e 67 65 72 20 6e |t is no |longer n|
|000038c0| 65 65 64 65 64 2e 0a 0a | 3c 50 3e 0a 3c 41 20 4e |eeded...|<P>.<A N|
|000038d0| 41 4d 45 3d 22 45 6e 76 | 69 72 6f 6e 6d 65 6e 74 |AME="Env|ironment|
|000038e0| 3a 3a 73 74 65 70 22 3e | 0a 3c 44 49 56 20 41 4c |::step">|.<DIV AL|
|000038f0| 49 47 4e 3d 52 49 47 48 | 54 3e 0a 5b 3c 41 20 48 |IGN=RIGH|T>.[<A H|
|00003900| 52 45 46 3d 22 72 6c 69 | 2e 68 2e 68 74 6d 6c 23 |REF="rli|.h.html#|
|00003910| 45 6e 76 69 72 6f 6e 6d | 65 6e 74 22 3e 70 75 72 |Environm|ent">pur|
|00003920| 65 20 76 69 72 74 75 61 | 6c 20 66 75 6e 63 74 69 |e virtua|l functi|
|00003930| 6f 6e 3c 2f 41 3e 5d 0a | 3c 2f 44 49 56 3e 20 0a |on</A>].|</DIV> .|
|00003940| 3c 2f 41 3e 0a 3c 54 54 | 3e 0a 64 6f 75 62 6c 65 |</A>.<TT|>.double|
|00003950| 20 3c 42 3e 3c 43 4f 44 | 45 3e 45 6e 76 69 72 6f | <B><COD|E>Enviro|
|00003960| 6e 6d 65 6e 74 3a 3a 73 | 74 65 70 3c 2f 43 4f 44 |nment::s|tep</COD|
|00003970| 45 3e 3c 2f 42 3e 0a 28 | 20 63 6f 6e 73 74 20 41 |E></B>.(| const A|
|00003980| 63 74 69 6f 6e 2a 20 3c | 56 41 52 3e 70 61 3c 2f |ction* <|VAR>pa</|
|00003990| 56 41 52 3e 2c 20 0a 20 | 20 63 6f 6e 73 74 20 53 |VAR>, . | const S|
|000039a0| 65 6e 73 61 74 69 6f 6e | 20 2a 26 61 6d 70 3b 3c |ensation| *&<|
|000039b0| 56 41 52 3e 70 6e 65 78 | 74 5f 73 3c 2f 56 41 52 |VAR>pnex|t_s</VAR|
|000039c0| 3e 2c 0a 20 20 64 6f 75 | 62 6c 65 20 26 61 6d 70 |>,. dou|ble &|
|000039d0| 3b 3c 56 41 52 3e 72 65 | 77 61 72 64 3c 2f 56 41 |;<VAR>re|ward</VA|
|000039e0| 52 3e 20 29 0a 3c 2f 54 | 54 3e 0a 0a 3c 50 3e 20 |R> ).</T|T>..<P> |
|000039f0| 54 68 69 73 20 69 73 20 | 74 68 65 20 6d 61 69 6e |This is |the main|
|00003a00| 20 66 75 6e 63 74 69 6f | 6e 20 66 6f 72 20 3c 43 | functio|n for <C|
|00003a10| 4f 44 45 3e 45 6e 76 69 | 72 6f 6e 6d 65 6e 74 3c |ODE>Envi|ronment<|
|00003a20| 2f 43 4f 44 45 3e 2e 20 | 20 49 74 20 6d 75 73 74 |/CODE>. | It must|
|00003a30| 0a 62 65 20 70 72 6f 76 | 69 64 65 64 20 62 79 20 |.be prov|ided by |
|00003a40| 74 68 65 20 75 73 65 72 | 20 61 6e 64 20 77 69 6c |the user| and wil|
|00003a50| 6c 20 62 65 20 63 61 6c | 6c 65 64 20 6f 6e 63 65 |l be cal|led once|
|00003a60| 20 62 79 20 74 68 65 20 | 73 69 6d 75 6c 61 74 69 | by the |simulati|
|00003a70| 6f 6e 0a 69 6e 73 74 61 | 6e 63 65 20 6f 6e 20 65 |on.insta|nce on e|
|00003a80| 61 63 68 20 73 74 65 70 | 20 6f 66 20 74 68 65 20 |ach step| of the |
|00003a90| 73 69 6d 75 6c 61 74 69 | 6f 6e 2e 0a 3c 43 4f 44 |simulati|on..<COD|
|00003aa0| 45 3e 45 6e 76 69 72 6f | 6e 6d 65 6e 74 3a 3a 73 |E>Enviro|nment::s|
|00003ab0| 74 65 70 3c 2f 43 4f 44 | 45 3e 20 63 61 75 73 65 |tep</COD|E> cause|
|00003ac0| 73 20 74 68 65 20 65 6e | 76 69 72 6f 6e 6d 65 6e |s the en|vironmen|
|00003ad0| 74 20 74 6f 20 75 6e 64 | 65 72 67 6f 20 61 0a 74 |t to und|ergo a.t|
|00003ae0| 72 61 6e 73 69 74 69 6f | 6e 20 66 72 6f 6d 20 69 |ransitio|n from i|
|00003af0| 74 73 20 63 75 72 72 65 | 6e 74 20 73 74 61 74 65 |ts curre|nt state|
|00003b00| 20 74 6f 20 61 20 6e 65 | 78 74 20 73 74 61 74 65 | to a ne|xt state|
|00003b10| 20 64 65 70 65 6e 64 65 | 6e 74 20 6f 6e 20 74 68 | depende|nt on th|
|00003b20| 65 0a 61 63 74 69 6f 6e | 20 70 6f 69 6e 74 65 64 |e.action| pointed|
|00003b30| 20 62 79 20 3c 56 41 52 | 3e 70 61 3c 2f 56 41 52 | by <VAR|>pa</VAR|
|00003b40| 3e 2e 20 54 68 65 20 66 | 75 6e 63 74 69 6f 6e 20 |>. The f|unction |
|00003b50| 72 65 74 75 72 6e 73 20 | 74 68 65 20 70 6f 69 6e |returns |the poin|
|00003b60| 74 65 72 0a 74 6f 20 74 | 68 65 20 6e 65 78 74 20 |ter.to t|he next |
|00003b70| 73 65 6e 73 61 74 69 6f | 6e 20 69 6e 20 74 68 65 |sensatio|n in the|
|00003b80| 20 72 65 66 65 72 65 6e | 63 65 20 3c 56 41 52 3e | referen|ce <VAR>|
|00003b90| 70 6e 65 78 74 5f 73 3c | 2f 56 41 52 3e 20 61 6e |pnext_s<|/VAR> an|
|00003ba0| 64 20 74 68 65 0a 70 61 | 79 6f 66 66 20 6f 66 20 |d the.pa|yoff of |
|00003bb0| 74 68 65 20 73 74 61 74 | 65 20 74 72 61 6e 73 69 |the stat|e transi|
|00003bc0| 74 69 6f 6e 20 69 6e 20 | 74 68 65 20 72 65 66 65 |tion in |the refe|
|00003bd0| 72 65 6e 63 65 20 3c 56 | 41 52 3e 72 65 77 61 72 |rence <V|AR>rewar|
|00003be0| 64 3c 2f 56 41 52 3e 2e | 0a 54 68 65 20 65 6e 76 |d</VAR>.|.The env|
|00003bf0| 69 72 6f 6e 6d 65 6e 74 | 20 69 6e 73 74 61 6e 63 |ironment| instanc|
|00003c00| 65 20 73 68 6f 75 6c 64 | 20 70 72 6f 76 69 64 65 |e should| provide|
|00003c10| 20 74 68 65 20 73 70 61 | 63 65 20 69 6e 20 6d 65 | the spa|ce in me|
|00003c20| 6d 6f 72 79 20 77 68 65 | 72 65 20 74 68 65 0a 73 |mory whe|re the.s|
|00003c30| 65 6e 73 61 74 69 6f 6e | 20 69 73 20 73 74 6f 72 |ensation| is stor|
|00003c40| 65 64 2c 20 77 68 69 63 | 68 20 73 68 6f 75 6c 64 |ed, whic|h should|
|00003c50| 20 70 65 72 73 69 73 74 | 20 61 66 74 65 72 20 74 | persist| after t|
|00003c60| 68 65 20 66 75 6e 63 74 | 69 6f 6e 20 69 73 0a 63 |he funct|ion is.c|
|00003c70| 61 6c 6c 65 64 2e 20 4d | 65 6d 6f 72 79 20 61 6c |alled. M|emory al|
|00003c80| 6c 6f 63 61 74 69 6f 6e | 20 73 68 6f 75 6c 64 20 |location| should |
|00003c90| 62 65 20 64 6f 6e 65 20 | 77 69 74 68 20 74 68 65 |be done |with the|
|00003ca0| 20 3c 43 4f 44 45 3e 6e | 65 77 3c 2f 43 4f 44 45 | <CODE>n|ew</CODE|
|00003cb0| 3e 0a 63 6f 6e 73 74 72 | 75 63 74 6f 72 2c 20 74 |>.constr|uctor, t|
|00003cc0| 68 65 20 73 69 6d 75 6c | 61 74 6f 72 20 74 61 6b |he simul|ator tak|
|00003cd0| 65 73 20 74 68 65 20 72 | 65 73 70 6f 6e 73 69 62 |es the r|esponsib|
|00003ce0| 69 6c 69 74 79 20 6f 66 | 20 66 72 65 65 69 6e 67 |ility of| freeing|
|00003cf0| 20 74 68 65 0a 6d 65 6d | 6f 72 79 20 77 69 74 68 | the.mem|ory with|
|00003d00| 20 3c 43 4f 44 45 3e 64 | 65 6c 65 74 65 3c 2f 43 | <CODE>d|elete</C|
|00003d10| 4f 44 45 3e 20 77 68 65 | 6e 20 74 68 65 20 6f 62 |ODE> whe|n the ob|
|00003d20| 6a 65 63 74 20 69 73 20 | 6e 6f 20 6c 6f 6e 67 65 |ject is |no longe|
|00003d30| 72 20 6e 65 65 64 65 64 | 2e 0a 0a 3c 50 3e 20 49 |r needed|...<P> I|
|00003d40| 66 20 74 68 65 20 74 72 | 61 6e 73 69 74 69 6f 6e |f the tr|ansition|
|00003d50| 20 69 73 20 69 6e 74 6f | 20 61 20 74 65 72 6d 69 | is into| a termi|
|00003d60| 6e 61 6c 20 73 74 61 74 | 65 2c 20 74 68 65 6e 20 |nal stat|e, then |
|00003d70| 74 68 65 20 70 6f 69 6e | 74 65 72 20 74 6f 0a 74 |the poin|ter to.t|
|00003d80| 68 65 20 6e 65 78 74 20 | 73 65 6e 73 61 74 69 6f |he next |sensatio|
|00003d90| 6e 20 72 65 74 75 72 6e | 65 64 20 6d 75 73 74 20 |n return|ed must |
|00003da0| 68 61 76 65 20 74 68 65 | 20 73 70 65 63 69 61 6c |have the| special|
|00003db0| 20 76 61 6c 75 65 0a 3c | 43 4f 44 45 3e 30 3c 2f | value.<|CODE>0</|
|00003dc0| 43 4f 44 45 3e 2e 0a 0a | 0a 3c 48 52 3e 0a 0a 3c |CODE>...|.<HR>..<|
|00003dd0| 41 20 4e 41 4d 45 3d 22 | 53 69 6d 75 6c 61 74 69 |A NAME="|Simulati|
|00003de0| 6f 6e 22 3e 0a 3c 48 32 | 3e 53 69 6d 75 6c 61 74 |on">.<H2|>Simulat|
|00003df0| 69 6f 6e 3c 2f 48 32 3e | 0a 3c 2f 41 3e 0a 0a 3c |ion</H2>|.</A>..<|
|00003e00| 50 3e 20 54 68 65 20 73 | 69 6d 75 6c 61 74 69 6f |P> The s|imulatio|
|00003e10| 6e 20 69 73 20 74 68 65 | 20 62 61 73 65 20 6f 62 |n is the| base ob|
|00003e20| 6a 65 63 74 20 6f 66 20 | 74 68 65 20 69 6e 74 65 |ject of |the inte|
|00003e30| 72 66 61 63 65 2e 20 20 | 49 74 20 6d 61 6e 61 67 |rface. |It manag|
|00003e40| 65 73 0a 74 68 65 20 69 | 6e 74 65 72 61 63 74 69 |es.the i|nteracti|
|00003e50| 6f 6e 20 62 65 74 77 65 | 65 6e 20 74 68 65 20 61 |on betwe|en the a|
|00003e60| 67 65 6e 74 20 61 6e 64 | 20 74 68 65 20 65 6e 76 |gent and| the env|
|00003e70| 69 72 6f 6e 6d 65 6e 74 | 2e 20 20 54 68 65 20 66 |ironment|. The f|
|00003e80| 75 6e 63 74 69 6f 6e 73 | 0a 3c 43 4f 44 45 3e 53 |unctions|.<CODE>S|
|00003e90| 69 6d 75 6c 61 74 69 6f | 6e 3a 3a 69 6e 69 74 3c |imulatio|n::init<|
|00003ea0| 2f 43 4f 44 45 3e 2c 20 | 3c 43 4f 44 45 3e 53 69 |/CODE>, |<CODE>Si|
|00003eb0| 6d 75 6c 61 74 69 6f 6e | 3a 3a 73 74 65 70 73 3c |mulation|::steps<|
|00003ec0| 2f 43 4f 44 45 3e 2c 0a | 61 6e 64 20 3c 43 4f 44 |/CODE>,.|and <COD|
|00003ed0| 45 3e 53 69 6d 75 6c 61 | 74 69 6f 6e 3a 3a 74 72 |E>Simula|tion::tr|
|00003ee0| 69 61 6c 73 3c 2f 43 4f | 44 45 3e 20 61 72 65 20 |ials</CO|DE> are |
|00003ef0| 3c 65 6d 3e 6e 6f 74 3c | 2f 65 6d 3e 20 69 6e 74 |<em>not<|/em> int|
|00003f00| 65 6e 64 65 64 20 74 6f | 0a 62 65 20 63 68 61 6e |ended to|.be chan|
|00003f10| 67 65 64 20 62 79 20 74 | 68 65 20 75 73 65 72 2e |ged by t|he user.|
|00003f20| 20 20 54 68 65 79 20 64 | 65 66 69 6e 65 20 74 68 | They d|efine th|
|00003f30| 65 20 68 65 61 72 74 20 | 6f 66 20 74 68 65 20 69 |e heart |of the i|
|00003f40| 6e 74 65 72 66 61 63 65 | 2c 20 74 68 65 0a 75 6e |nterface|, the.un|
|00003f50| 69 66 6f 72 6d 20 75 73 | 61 67 65 20 74 68 61 74 |iform us|age that|
|00003f60| 20 61 6c 6c 20 61 67 65 | 6e 74 73 20 61 6e 64 20 | all age|nts and |
|00003f70| 65 6e 76 69 72 6f 6e 6d | 65 6e 74 73 20 61 72 65 |environm|ents are|
|00003f80| 20 6d 65 61 6e 74 20 74 | 6f 20 63 6f 6e 66 6f 72 | meant t|o confor|
|00003f90| 6d 0a 74 6f 2e 20 41 20 | 73 69 6d 75 6c 61 74 69 |m.to. A |simulati|
|00003fa0| 6f 6e 20 63 6c 61 73 73 | 20 69 73 20 63 72 65 61 |on class| is crea|
|00003fb0| 74 65 64 20 62 79 20 64 | 65 72 69 76 69 6e 67 20 |ted by d|eriving |
|00003fc0| 66 72 6f 6d 0a 3c 43 4f | 44 45 3e 53 69 6d 75 6c |from.<CO|DE>Simul|
|00003fd0| 61 74 69 6f 6e 3c 2f 43 | 4f 44 45 3e 20 61 6e 64 |ation</C|ODE> and|
|00003fe0| 20 70 72 6f 76 69 64 69 | 6e 67 20 74 68 65 20 69 | providi|ng the i|
|00003ff0| 6d 70 6c 65 6d 65 6e 74 | 61 74 69 6f 6e 20 74 6f |mplement|ation to|
|00004000| 20 74 68 65 20 3c 41 0a | 48 52 45 46 3d 22 23 53 | the <A.|HREF="#S|
|00004010| 69 6d 75 6c 61 74 69 6f | 6e 3a 3a 63 6f 6c 6c 65 |imulatio|n::colle|
|00004020| 63 74 5f 64 61 74 61 22 | 3e 3c 43 4f 44 45 3e 53 |ct_data"|><CODE>S|
|00004030| 69 6d 75 6c 61 74 69 6f | 6e 3a 3a 63 6f 6c 6c 65 |imulatio|n::colle|
|00004040| 63 74 5f 64 61 74 61 3c | 2f 43 4f 44 45 3e 3c 2f |ct_data<|/CODE></|
|00004050| 41 3e 0a 76 69 72 74 75 | 61 6c 20 66 75 6e 63 74 |A>.virtu|al funct|
|00004060| 69 6f 6e 2e 0a 0a 3c 50 | 3e 20 53 69 6d 75 6c 61 |ion...<P|> Simula|
|00004070| 74 69 6f 6e 73 20 63 61 | 6e 20 62 65 20 73 70 65 |tions ca|n be spe|
|00004080| 63 69 61 6c 69 7a 65 64 | 20 74 6f 20 70 72 6f 76 |cialized| to prov|
|00004090| 69 64 65 20 72 65 70 6f | 72 74 69 6e 67 20 28 73 |ide repo|rting (s|
|000040a0| 65 65 20 3c 41 0a 48 52 | 45 46 3d 22 23 53 69 6d |ee <A.HR|EF="#Sim|
|000040b0| 75 6c 61 74 69 6f 6e 3a | 3a 73 74 61 72 74 5f 74 |ulation:|:start_t|
|000040c0| 72 69 61 6c 22 3e 3c 43 | 4f 44 45 3e 53 69 6d 75 |rial"><C|ODE>Simu|
|000040d0| 6c 61 74 69 6f 6e 3a 3a | 73 74 61 72 74 5f 74 72 |lation::|start_tr|
|000040e0| 69 61 6c 3c 2f 43 4f 44 | 45 3e 3c 2f 41 3e 0a 61 |ial</COD|E></A>.a|
|000040f0| 6e 64 20 3c 41 0a 48 52 | 45 46 3d 22 23 53 69 6d |nd <A.HR|EF="#Sim|
|00004100| 75 6c 61 74 69 6f 6e 3a | 3a 63 6f 6c 6c 65 63 74 |ulation:|:collect|
|00004110| 5f 64 61 74 61 22 3e 3c | 43 4f 44 45 3e 53 69 6d |_data"><|CODE>Sim|
|00004120| 75 6c 61 74 69 6f 6e 3a | 3a 63 6f 6c 6c 65 63 74 |ulation:|:collect|
|00004130| 5f 64 61 74 61 3c 2f 43 | 4f 44 45 3e 3c 2f 41 3e |_data</C|ODE></A>|
|00004140| 29 0a 61 6e 64 20 64 69 | 73 70 6c 61 79 20 63 61 |).and di|splay ca|
|00004150| 70 61 62 69 6c 69 74 69 | 65 73 2e 20 46 6f 72 20 |pabiliti|es. For |
|00004160| 65 78 61 6d 70 6c 65 2c | 20 61 20 64 69 73 70 6c |example,| a displ|
|00004170| 61 79 20 6d 61 79 20 73 | 74 61 72 74 20 6f 72 20 |ay may s|tart or |
|00004180| 73 74 6f 70 20 74 68 65 | 0a 73 69 6d 75 6c 61 74 |stop the|.simulat|
|00004190| 69 6f 6e 20 61 6e 64 20 | 73 68 6f 77 20 69 74 73 |ion and |show its|
|000041a0| 20 70 72 6f 67 72 65 73 | 73 20 69 6e 20 76 61 72 | progres|s in var|
|000041b0| 69 6f 75 73 20 77 61 79 | 73 2e 20 20 44 69 73 70 |ious way|s. Disp|
|000041c0| 6c 61 79 20 75 70 64 61 | 74 65 73 20 63 61 6e 0a |lay upda|tes can.|
|000041d0| 62 65 20 74 72 69 67 67 | 65 72 65 64 20 69 6e 20 |be trigg|ered in |
|000041e0| 3c 43 4f 44 45 3e 53 69 | 6d 75 6c 61 74 69 6f 6e |<CODE>Si|mulation|
|000041f0| 3a 3a 63 6f 6c 6c 65 63 | 74 5f 64 61 74 61 3c 2f |::collec|t_data</|
|00004200| 43 4f 44 45 3e 2c 0a 3c | 43 4f 44 45 3e 41 67 65 |CODE>,.<|CODE>Age|
|00004210| 6e 74 3a 3a 73 74 65 70 | 3c 2f 43 4f 44 45 3e 2c |nt::step|</CODE>,|
|00004220| 20 3c 43 4f 44 45 3e 45 | 6e 76 69 72 6f 6e 6d 65 | <CODE>E|nvironme|
|00004230| 6e 74 3a 3a 73 74 65 70 | 3c 2f 43 4f 44 45 3e 2c |nt::step|</CODE>,|
|00004240| 20 6f 72 0a 77 68 61 74 | 65 76 65 72 2c 20 62 79 | or.what|ever, by|
|00004250| 20 63 61 6c 6c 69 6e 67 | 20 75 73 65 72 2d 70 72 | calling| user-pr|
|00004260| 6f 76 69 64 65 64 20 66 | 75 6e 63 74 69 6f 6e 73 |ovided f|unctions|
|00004270| 20 61 73 73 6f 63 69 61 | 74 65 64 20 77 69 74 68 | associa|ted with|
|00004280| 20 74 68 65 0a 73 70 65 | 63 69 61 6c 69 7a 65 64 | the.spe|cialized|
|00004290| 20 73 69 6d 75 6c 61 74 | 69 6f 6e 20 6f 62 6a 65 | simulat|ion obje|
|000042a0| 63 74 20 28 61 63 63 65 | 73 73 69 62 6c 65 20 76 |ct (acce|ssible v|
|000042b0| 69 61 20 3c 43 4f 44 45 | 3e 3c 41 0a 48 52 45 46 |ia <CODE|><A.HREF|
|000042c0| 3d 22 23 63 72 6f 73 73 | 2d 72 65 66 65 72 65 6e |="#cross|-referen|
|000042d0| 63 65 22 3e 41 67 65 6e | 74 3a 3a 70 73 69 6d 3c |ce">Agen|t::psim<|
|000042e0| 2f 41 3e 3c 2f 43 4f 44 | 45 3e 20 6f 72 20 3c 43 |/A></COD|E> or <C|
|000042f0| 4f 44 45 3e 3c 41 0a 48 | 52 45 46 3d 22 23 63 72 |ODE><A.H|REF="#cr|
|00004300| 6f 73 73 2d 72 65 66 65 | 72 65 6e 63 65 22 3e 45 |oss-refe|rence">E|
|00004310| 6e 76 69 72 6f 6e 6d 65 | 6e 74 3a 3a 70 73 69 6d |nvironme|nt::psim|
|00004320| 3c 2f 41 3e 3c 2f 43 4f | 44 45 3e 20 6d 65 6d 62 |</A></CO|DE> memb|
|00004330| 65 72 0a 70 6f 69 6e 74 | 65 72 73 29 2e 0a 0a 3c |er.point|ers)...<|
|00004340| 50 3e 0a 3c 44 49 56 20 | 41 4c 49 47 4e 3d 52 49 |P>.<DIV |ALIGN=RI|
|00004350| 47 48 54 3e 20 0a 5b 3c | 41 20 48 52 45 46 3d 22 |GHT> .[<|A HREF="|
|00004360| 72 6c 69 2e 68 2e 68 74 | 6d 6c 23 53 69 6d 75 6c |rli.h.ht|ml#Simul|
|00004370| 61 74 69 6f 6e 22 3e 63 | 6c 61 73 73 3c 2f 41 3e |ation">c|lass</A>|
|00004380| 5d 0a 3c 2f 44 49 56 3e | 20 0a 3c 54 54 3e 0a 3c |].</DIV>| .<TT>.<|
|00004390| 42 3e 3c 43 4f 44 45 3e | 53 69 6d 75 6c 61 74 69 |B><CODE>|Simulati|
|000043a0| 6f 6e 3c 2f 43 4f 44 45 | 3e 3c 2f 42 3e 0a 3c 2f |on</CODE|></B>.</|
|000043b0| 54 54 3e 20 0a 0a 3c 50 | 3e 54 68 65 20 62 61 73 |TT> ..<P|>The bas|
|000043c0| 69 63 20 63 6c 61 73 73 | 20 6f 66 20 61 6c 6c 20 |ic class| of all |
|000043d0| 73 69 6d 75 6c 61 74 69 | 6f 6e 73 2e 20 20 3c 41 |simulati|ons. <A|
|000043e0| 0a 48 52 45 46 3d 22 23 | 70 72 6f 74 6f 2d 65 78 |.HREF="#|proto-ex|
|000043f0| 61 6d 70 6c 65 22 3e 45 | 61 72 6c 69 65 72 3c 2f |ample">E|arlier</|
|00004400| 41 3e 20 77 65 20 73 61 | 77 20 61 20 70 72 6f 74 |A> we sa|w a prot|
|00004410| 6f 74 79 70 69 63 61 6c | 20 65 78 61 6d 70 6c 65 |otypical| example|
|00004420| 20 6f 66 20 74 68 65 0a | 75 73 65 20 6f 66 20 61 | of the.|use of a|
|00004430| 20 3c 43 4f 44 45 3e 73 | 69 6d 75 6c 61 74 69 6f | <CODE>s|imulatio|
|00004440| 6e 3c 2f 43 4f 44 45 3e | 2e 20 41 6e 20 69 6e 73 |n</CODE>|. An ins|
|00004450| 74 61 6e 63 65 20 6f 66 | 20 74 68 65 20 73 69 6d |tance of| the sim|
|00004460| 75 6c 61 74 69 6f 6e 20 | 69 73 0a 61 73 73 6f 63 |ulation |is.assoc|
|00004470| 69 61 74 65 64 20 77 69 | 74 68 20 61 6e 20 61 67 |iated wi|th an ag|
|00004480| 65 6e 74 20 61 6e 64 20 | 61 6e 20 65 6e 76 69 72 |ent and |an envir|
|00004490| 6f 6e 6d 65 6e 74 20 69 | 6e 73 74 61 6e 63 65 73 |onment i|nstances|
|000044a0| 20 61 74 20 74 68 65 20 | 6d 6f 6d 65 6e 74 20 6f | at the |moment o|
|000044b0| 66 0a 63 72 65 61 74 69 | 6f 6e 2e 20 54 68 69 73 |f.creati|on. This|
|000044c0| 20 69 73 20 70 65 72 66 | 6f 72 6d 65 64 20 69 6e | is perf|ormed in|
|000044d0| 20 74 68 65 20 63 6f 6e | 73 74 72 75 63 74 6f 72 | the con|structor|
|000044e0| 20 6f 66 0a 3c 43 4f 44 | 45 3e 53 69 6d 75 6c 61 | of.<COD|E>Simula|
|000044f0| 74 6f 72 3c 2f 43 4f 44 | 45 3e 2c 20 77 68 69 63 |tor</COD|E>, whic|
|00004500| 68 20 74 61 6b 65 73 20 | 74 68 65 20 66 6f 72 6d |h takes |the form|
|00004510| 20 6f 66 0a 3c 43 4f 44 | 45 3e 53 69 6d 75 6c 61 | of.<COD|E>Simula|
|00004520| 74 6f 72 3a 3a 53 69 6d | 75 6c 61 74 6f 72 3c 2f |tor::Sim|ulator</|
|00004530| 43 4f 44 45 3e 28 20 41 | 67 65 6e 74 20 2a 3c 56 |CODE>( A|gent *<V|
|00004540| 41 52 3e 70 61 3c 2f 56 | 41 52 3e 2c 20 45 6e 76 |AR>pa</V|AR>, Env|
|00004550| 69 72 6f 6e 6d 65 6e 74 | 0a 2a 3c 56 41 52 3e 70 |ironment|.*<VAR>p|
|00004560| 65 3c 2f 56 41 52 3e 20 | 29 2e 0a 0a 3c 50 3e 0a |e</VAR> |)...<P>.|
|00004570| 3c 41 20 4e 41 4d 45 3d | 22 53 69 6d 75 6c 61 74 |<A NAME=|"Simulat|
|00004580| 69 6f 6e 3a 3a 69 6e 69 | 74 22 3e 0a 3c 44 49 56 |ion::ini|t">.<DIV|
|00004590| 20 41 4c 49 47 4e 3d 52 | 49 47 48 54 3e 0a 5b 3c | ALIGN=R|IGHT>.[<|
|000045a0| 41 20 48 52 45 46 3d 22 | 72 6c 69 2e 63 63 2e 68 |A HREF="|rli.cc.h|
|000045b0| 74 6d 6c 23 53 69 6d 75 | 6c 61 74 69 6f 6e 3a 3a |tml#Simu|lation::|
|000045c0| 69 6e 69 74 22 3e 76 69 | 72 74 75 61 6c 20 66 75 |init">vi|rtual fu|
|000045d0| 6e 63 74 69 6f 6e 3c 2f | 41 3e 5d 0a 3c 2f 44 49 |nction</|A>].</DI|
|000045e0| 56 3e 20 0a 3c 2f 41 3e | 0a 3c 54 54 3e 0a 76 6f |V> .</A>|.<TT>.vo|
|000045f0| 69 64 20 3c 42 3e 3c 43 | 4f 44 45 3e 53 69 6d 75 |id <B><C|ODE>Simu|
|00004600| 6c 61 74 6f 6e 3a 3a 69 | 6e 69 74 3c 2f 43 4f 44 |laton::i|nit</COD|
|00004610| 45 3e 3c 2f 42 3e 0a 28 | 20 69 6e 74 20 3c 56 41 |E></B>.(| int <VA|
|00004620| 52 3e 61 72 67 63 3c 2f | 56 41 52 3e 2c 20 63 68 |R>argc</|VAR>, ch|
|00004630| 61 72 20 2a 3c 56 41 52 | 3e 61 72 67 76 3c 2f 56 |ar *<VAR|>argv</V|
|00004640| 41 52 3e 5b 5d 20 29 0a | 3c 2f 54 54 3e 0a 0a 3c |AR>[] ).|</TT>..<|
|00004650| 50 3e 20 3c 43 4f 44 45 | 3e 53 69 6d 75 6c 61 74 |P> <CODE|>Simulat|
|00004660| 69 6f 6e 3a 3a 69 6e 69 | 74 3c 2f 43 4f 44 45 3e |ion::ini|t</CODE>|
|00004670| 20 69 6e 69 74 69 61 6c | 69 7a 65 73 20 74 68 65 | initial|izes the|
|00004680| 20 73 69 6d 75 6c 61 74 | 69 6f 6e 0a 69 6e 73 74 | simulat|ion.inst|
|00004690| 61 6e 63 65 2c 20 74 68 | 65 20 61 67 65 6e 74 2c |ance, th|e agent,|
|000046a0| 20 61 6e 64 20 74 68 65 | 20 65 6e 76 69 72 6f 6e | and the| environ|
|000046b0| 6d 65 6e 74 2c 20 77 68 | 69 63 68 20 73 68 6f 75 |ment, wh|ich shou|
|000046c0| 6c 64 20 62 65 20 69 6e | 73 74 61 6e 63 65 73 20 |ld be in|stances |
|000046d0| 6f 66 0a 63 6c 61 73 73 | 65 73 20 64 65 72 69 76 |of.class|es deriv|
|000046e0| 65 64 20 66 72 6f 6d 20 | 74 68 65 20 72 65 73 70 |ed from |the resp|
|000046f0| 65 63 74 69 76 65 20 61 | 62 73 74 72 61 63 74 20 |ective a|bstract |
|00004700| 63 6c 61 73 73 65 73 2e | 20 20 49 74 20 61 6c 73 |classes.| It als|
|00004710| 6f 20 63 61 6c 6c 73 0a | 3c 43 4f 44 45 3e 53 69 |o calls.|<CODE>Si|
|00004720| 6d 75 6c 61 74 69 6f 6e | 3a 3a 73 74 61 72 74 5f |mulation|::start_|
|00004730| 74 72 69 61 6c 3c 2f 43 | 4f 44 45 3e 20 61 66 74 |trial</C|ODE> aft|
|00004740| 65 72 20 69 6e 69 74 69 | 61 6c 69 7a 69 6e 67 20 |er initi|alizing |
|00004750| 74 68 65 20 61 67 65 6e | 74 0a 61 6e 64 20 65 6e |the agen|t.and en|
|00004760| 76 69 72 6f 6e 6d 65 6e | 74 20 69 6e 73 74 61 6e |vironmen|t instan|
|00004770| 63 65 73 20 69 6e 20 6f | 72 64 65 72 20 74 6f 20 |ces in o|rder to |
|00004780| 73 65 74 20 75 70 20 74 | 68 65 20 73 69 6d 75 6c |set up t|he simul|
|00004790| 61 74 69 6f 6e 20 6f 62 | 6a 65 63 74 0a 72 65 61 |ation ob|ject.rea|
|000047a0| 64 79 20 66 6f 72 20 3c | 43 4f 44 45 3e 53 69 6d |dy for <|CODE>Sim|
|000047b0| 75 6c 61 74 69 6f 6e 3a | 3a 73 74 65 70 73 3c 2f |ulation:|:steps</|
|000047c0| 43 4f 44 45 3e 20 61 6e | 64 2f 6f 72 0a 3c 43 4f |CODE> an|d/or.<CO|
|000047d0| 44 45 3e 53 69 6d 75 6c | 61 74 69 6f 6e 3a 3a 74 |DE>Simul|ation::t|
|000047e0| 72 69 61 6c 73 3c 2f 43 | 4f 44 45 3e 2e 20 53 65 |rials</C|ODE>. Se|
|000047f0| 65 20 74 68 65 20 73 6f | 75 72 63 65 20 63 6f 64 |e the so|urce cod|
|00004800| 65 20 28 62 79 0a 63 6c | 69 63 6b 69 6e 67 20 6f |e (by.cl|icking o|
|00004810| 6e 20 74 68 65 20 62 72 | 61 63 6b 65 74 65 64 20 |n the br|acketed |
|00004820| 22 66 75 6e 63 74 69 6f | 6e 22 20 61 62 6f 76 65 |"functio|n" above|
|00004830| 20 72 69 67 68 74 29 20 | 74 6f 20 73 65 65 20 6a | right) |to see j|
|00004840| 75 73 74 20 68 6f 77 20 | 74 68 69 73 0a 77 6f 72 |ust how |this.wor|
|00004850| 6b 73 2e 0a 0a 3c 50 3e | 0a 3c 41 20 4e 41 4d 45 |ks...<P>|.<A NAME|
|00004860| 3d 22 53 69 6d 75 6c 61 | 74 69 6f 6e 3a 3a 73 74 |="Simula|tion::st|
|00004870| 61 72 74 5f 74 72 69 61 | 6c 22 3e 0a 3c 44 49 56 |art_tria|l">.<DIV|
|00004880| 20 41 4c 49 47 4e 3d 52 | 49 47 48 54 3e 0a 5b 3c | ALIGN=R|IGHT>.[<|
|00004890| 41 20 48 52 45 46 3d 22 | 72 6c 69 2e 63 63 2e 68 |A HREF="|rli.cc.h|
|000048a0| 74 6d 6c 23 53 69 6d 75 | 6c 61 74 69 6f 6e 3a 3a |tml#Simu|lation::|
|000048b0| 73 74 61 72 74 5f 74 72 | 69 61 6c 22 3e 76 69 72 |start_tr|ial">vir|
|000048c0| 74 75 61 6c 20 66 75 6e | 63 74 69 6f 6e 3c 2f 41 |tual fun|ction</A|
|000048d0| 3e 5d 0a 3c 2f 44 49 56 | 3e 20 0a 3c 2f 41 3e 0a |>].</DIV|> .</A>.|
|000048e0| 3c 54 54 3e 0a 76 6f 69 | 64 20 3c 42 3e 3c 43 4f |<TT>.voi|d <B><CO|
|000048f0| 44 45 3e 53 69 6d 75 6c | 61 74 69 6f 6e 3a 3a 73 |DE>Simul|ation::s|
|00004900| 74 61 72 74 5f 74 72 69 | 61 6c 3c 2f 43 4f 44 45 |tart_tri|al</CODE|
|00004910| 3e 3c 2f 42 3e 0a 28 20 | 76 6f 69 64 20 29 0a 3c |></B>.( |void ).<|
|00004920| 2f 54 54 3e 0a 0a 3c 50 | 3e 20 54 68 69 73 20 66 |/TT>..<P|> This f|
|00004930| 75 6e 63 74 69 6f 6e 20 | 66 6f 72 63 65 73 20 74 |unction |forces t|
|00004940| 68 65 20 62 65 67 69 6e | 6e 69 6e 67 0a 6f 66 20 |he begin|ning.of |
|00004950| 61 20 6e 65 77 20 74 72 | 69 61 6c 2e 20 54 68 69 |a new tr|ial. Thi|
|00004960| 73 20 69 73 20 64 6f 6e | 65 20 70 72 69 6d 61 72 |s is don|e primar|
|00004970| 69 6c 79 20 62 79 20 63 | 61 6c 6c 73 20 74 6f 0a |ily by c|alls to.|
|00004980| 3c 43 4f 44 45 3e 45 6e | 76 69 72 6f 6e 6d 65 6e |<CODE>En|vironmen|
|00004990| 74 3a 3a 73 74 61 72 74 | 5f 74 72 69 61 6c 3c 2f |t::start|_trial</|
|000049a0| 43 4f 44 45 3e 20 61 6e | 64 0a 3c 43 4f 44 45 3e |CODE> an|d.<CODE>|
|000049b0| 41 67 65 6e 74 3a 3a 73 | 74 61 72 74 5f 74 72 69 |Agent::s|tart_tri|
|000049c0| 61 6c 3c 2f 43 4f 44 45 | 3e 20 74 6f 20 67 65 74 |al</CODE|> to get|
|000049d0| 20 74 68 65 20 66 69 72 | 73 74 20 73 65 6e 73 61 | the fir|st sensa|
|000049e0| 74 69 6f 6e 20 6f 66 20 | 74 68 65 0a 65 6e 76 69 |tion of |the.envi|
|000049f0| 72 6f 6e 6d 65 6e 74 20 | 61 6e 64 20 66 69 72 73 |ronment |and firs|
|00004a00| 74 20 61 63 74 69 6f 6e | 20 6f 66 20 74 68 65 20 |t action| of the |
|00004a10| 61 67 65 6e 74 20 72 65 | 73 70 65 63 74 69 76 65 |agent re|spective|
|00004a20| 6c 79 2e 20 55 73 65 72 | 2d 64 65 66 69 6e 65 64 |ly. User|-defined|
|00004a30| 0a 73 70 65 63 69 61 6c | 69 7a 65 64 20 6d 65 74 |.special|ized met|
|00004a40| 68 6f 64 73 20 6d 61 79 | 20 61 6c 73 6f 20 63 6f |hods may| also co|
|00004a50| 6d 70 75 74 65 20 61 76 | 65 72 61 67 65 20 6f 72 |mpute av|erage or|
|00004a60| 20 61 63 63 75 6d 75 6c | 61 74 65 64 20 72 65 77 | accumul|ated rew|
|00004a70| 61 72 64 73 20 70 65 72 | 0a 74 72 69 61 6c 20 6f |ards per|.trial o|
|00004a80| 72 20 6f 74 68 65 72 20 | 64 61 74 61 20 61 6e 64 |r other |data and|
|00004a90| 20 75 70 64 61 74 65 20 | 64 69 73 70 6c 61 79 73 | update |displays|
|00004aa0| 2e 0a 0a 3c 50 3e 0a 3c | 41 20 4e 41 4d 45 3d 22 |...<P>.<|A NAME="|
|00004ab0| 53 69 6d 75 6c 61 74 69 | 6f 6e 3a 3a 73 74 65 70 |Simulati|on::step|
|00004ac0| 73 22 3e 0a 3c 44 49 56 | 20 41 4c 49 47 4e 3d 52 |s">.<DIV| ALIGN=R|
|00004ad0| 49 47 48 54 3e 0a 5b 3c | 41 20 48 52 45 46 3d 22 |IGHT>.[<|A HREF="|
|00004ae0| 72 6c 69 2e 63 63 2e 68 | 74 6d 6c 23 53 69 6d 75 |rli.cc.h|tml#Simu|
|00004af0| 6c 61 74 69 6f 6e 3a 3a | 73 74 65 70 73 22 3e 76 |lation::|steps">v|
|00004b00| 69 72 74 75 61 6c 20 66 | 75 6e 63 74 69 6f 6e 3c |irtual f|unction<|
|00004b10| 2f 41 3e 5d 0a 3c 2f 44 | 49 56 3e 20 0a 3c 2f 41 |/A>].</D|IV> .</A|
|00004b20| 3e 0a 3c 54 54 3e 0a 76 | 6f 69 64 20 3c 42 3e 3c |>.<TT>.v|oid <B><|
|00004b30| 43 4f 44 45 3e 53 69 6d | 75 6c 61 74 69 6f 6e 3a |CODE>Sim|ulation:|
|00004b40| 3a 73 74 65 70 73 3c 2f | 43 4f 44 45 3e 3c 2f 42 |:steps</|CODE></B|
|00004b50| 3e 0a 28 20 6c 6f 6e 67 | 20 3c 56 41 52 3e 6e 75 |>.( long| <VAR>nu|
|00004b60| 6d 5f 73 74 65 70 73 3c | 2f 56 41 52 3e 20 29 0a |m_steps<|/VAR> ).|
|00004b70| 3c 2f 54 54 3e 0a 0a 3c | 50 3e 20 52 75 6e 73 20 |</TT>..<|P> Runs |
|00004b80| 74 68 65 20 73 69 6d 75 | 6c 61 74 69 6f 6e 20 66 |the simu|lation f|
|00004b90| 6f 72 20 3c 56 41 52 3e | 6e 75 6d 5f 73 74 65 70 |or <VAR>|num_step|
|00004ba0| 73 3c 2f 56 41 52 3e 20 | 73 74 65 70 73 2c 20 73 |s</VAR> |steps, s|
|00004bb0| 74 61 72 74 69 6e 67 20 | 66 72 6f 6d 0a 77 68 61 |tarting |from.wha|
|00004bc0| 74 65 76 65 72 20 73 74 | 61 74 65 20 74 68 65 20 |tever st|ate the |
|00004bd0| 65 6e 76 69 72 6f 6e 6d | 65 6e 74 20 69 73 20 69 |environm|ent is i|
|00004be0| 6e 2e 20 20 49 66 20 74 | 68 65 20 74 65 72 6d 69 |n. If t|he termi|
|00004bf0| 6e 61 6c 20 73 74 61 74 | 65 20 69 73 0a 72 65 61 |nal stat|e is.rea|
|00004c00| 63 68 65 64 2c 20 74 68 | 65 20 73 69 6d 75 6c 61 |ched, th|e simula|
|00004c10| 74 69 6f 6e 20 69 73 20 | 69 6d 6d 65 64 69 61 74 |tion is |immediat|
|00004c20| 65 6c 79 20 70 72 65 70 | 61 72 65 64 20 66 6f 72 |ely prep|ared for|
|00004c30| 20 61 20 6e 65 77 20 74 | 72 69 61 6c 20 62 79 0a | a new t|rial by.|
|00004c40| 63 61 6c 6c 69 6e 67 20 | 3c 43 4f 44 45 3e 53 69 |calling |<CODE>Si|
|00004c50| 6d 75 6c 61 74 69 6f 6e | 3a 3a 73 74 61 72 74 5f |mulation|::start_|
|00004c60| 74 72 69 61 6c 3c 2f 43 | 4f 44 45 3e 2e 20 54 68 |trial</C|ODE>. Th|
|00004c70| 65 20 73 77 69 74 63 68 | 20 66 72 6f 6d 20 74 68 |e switch| from th|
|00004c80| 65 0a 74 65 72 6d 69 6e | 61 6c 20 73 74 61 74 65 |e.termin|al state|
|00004c90| 20 74 6f 20 74 68 65 20 | 6e 65 77 20 73 74 61 72 | to the |new star|
|00004ca0| 74 69 6e 67 20 73 74 61 | 74 65 20 64 6f 65 73 20 |ting sta|te does |
|00004cb0| 6e 6f 74 20 63 6f 75 6e | 74 20 61 73 20 61 0a 73 |not coun|t as a.s|
|00004cc0| 74 65 70 2e 20 54 68 75 | 73 2c 20 74 68 69 73 20 |tep. Thu|s, this |
|00004cd0| 66 75 6e 63 74 69 6f 6e | 20 61 6c 6c 6f 77 73 20 |function| allows |
|00004ce0| 74 68 65 20 75 73 65 72 | 20 74 6f 20 63 6f 6e 74 |the user| to cont|
|00004cf0| 72 6f 6c 20 74 68 65 20 | 65 78 65 63 75 74 69 6f |rol the |executio|
|00004d00| 6e 20 6f 66 0a 68 65 72 | 20 73 69 6d 75 6c 61 74 |n of.her| simulat|
|00004d10| 69 6f 6e 20 62 79 20 70 | 72 6f 76 69 64 69 6e 67 |ion by p|roviding|
|00004d20| 20 74 68 65 20 74 6f 74 | 61 6c 20 6e 75 6d 62 65 | the tot|al numbe|
|00004d30| 72 20 6f 66 20 73 74 65 | 70 73 20 64 69 72 65 63 |r of ste|ps direc|
|00004d40| 74 6c 79 2e 0a 0a 0a 3c | 50 3e 0a 3c 41 20 4e 41 |tly....<|P>.<A NA|
|00004d50| 4d 45 3d 22 53 69 6d 75 | 6c 61 74 69 6f 6e 3a 3a |ME="Simu|lation::|
|00004d60| 74 72 69 61 6c 73 22 3e | 0a 3c 44 49 56 20 41 4c |trials">|.<DIV AL|
|00004d70| 49 47 4e 3d 52 49 47 48 | 54 3e 0a 5b 3c 41 20 48 |IGN=RIGH|T>.[<A H|
|00004d80| 52 45 46 3d 22 72 6c 69 | 2e 63 63 2e 68 74 6d 6c |REF="rli|.cc.html|
|00004d90| 23 53 69 6d 75 6c 61 74 | 69 6f 6e 3a 3a 74 72 69 |#Simulat|ion::tri|
|00004da0| 61 6c 73 22 3e 76 69 72 | 74 75 61 6c 20 66 75 6e |als">vir|tual fun|
|00004db0| 63 74 69 6f 6e 3c 2f 41 | 3e 5d 0a 3c 2f 44 49 56 |ction</A|>].</DIV|
|00004dc0| 3e 20 0a 3c 2f 41 3e 0a | 3c 54 54 3e 0a 76 6f 69 |> .</A>.|<TT>.voi|
|00004dd0| 64 20 3c 42 3e 3c 43 4f | 44 45 3e 53 69 6d 75 6c |d <B><CO|DE>Simul|
|00004de0| 61 74 69 6f 6e 3a 3a 74 | 72 69 61 6c 73 3c 2f 43 |ation::t|rials</C|
|00004df0| 4f 44 45 3e 3c 2f 42 3e | 0a 28 20 6c 6f 6e 67 20 |ODE></B>|.( long |
|00004e00| 3c 56 41 52 3e 6e 75 6d | 5f 74 72 69 61 6c 73 3c |<VAR>num|_trials<|
|00004e10| 2f 56 41 52 3e 2c 20 6c | 6f 6e 67 20 3c 56 41 52 |/VAR>, l|ong <VAR|
|00004e20| 3e 6d 61 78 5f 73 74 65 | 70 73 5f 70 65 72 5f 74 |>max_ste|ps_per_t|
|00004e30| 72 69 61 6c 3c 2f 56 41 | 52 3e 20 29 0a 3c 2f 54 |rial</VA|R> ).</T|
|00004e40| 54 3e 0a 0a 3c 50 3e 20 | 52 75 6e 73 20 74 68 65 |T>..<P> |Runs the|
|00004e50| 20 73 69 6d 75 6c 61 74 | 69 6f 6e 20 66 6f 72 20 | simulat|ion for |
|00004e60| 3c 56 41 52 3e 6e 75 6d | 5f 74 72 69 61 6c 73 3c |<VAR>num|_trials<|
|00004e70| 2f 56 41 52 3e 20 74 72 | 69 61 6c 73 2c 20 73 74 |/VAR> tr|ials, st|
|00004e80| 61 72 74 69 6e 67 0a 66 | 72 6f 6d 20 77 68 61 74 |arting.f|rom what|
|00004e90| 65 76 65 72 20 73 74 61 | 74 65 20 74 68 65 20 65 |ever sta|te the e|
|00004ea0| 6e 76 69 72 6f 6e 6d 65 | 6e 74 20 69 73 20 69 6e |nvironme|nt is in|
|00004eb0| 2e 20 45 61 63 68 20 74 | 72 69 61 6c 20 63 61 6e |. Each t|rial can|
|00004ec0| 20 62 65 20 6e 6f 20 6c | 6f 6e 67 65 72 0a 74 68 | be no l|onger.th|
|00004ed0| 61 6e 20 3c 56 41 52 3e | 6d 61 78 5f 73 74 65 70 |an <VAR>|max_step|
|00004ee0| 73 5f 70 65 72 5f 74 72 | 69 61 6c 3c 2f 56 41 52 |s_per_tr|ial</VAR|
|00004ef0| 3e 20 73 74 65 70 73 2e | 20 20 45 61 63 68 20 74 |> steps.| Each t|
|00004f00| 72 69 61 6c 20 62 65 67 | 69 6e 73 20 62 79 0a 63 |rial beg|ins by.c|
|00004f10| 61 6c 6c 69 6e 67 20 3c | 43 4f 44 45 3e 53 69 6d |alling <|CODE>Sim|
|00004f20| 75 6c 61 74 69 6f 6e 3a | 3a 73 74 61 72 74 5f 74 |ulation:|:start_t|
|00004f30| 72 69 61 6c 3c 2f 43 4f | 44 45 3e 20 61 6e 64 20 |rial</CO|DE> and |
|00004f40| 65 6e 64 73 20 77 68 65 | 6e 20 74 68 65 0a 74 65 |ends whe|n the.te|
|00004f50| 72 6d 69 6e 61 6c 20 73 | 74 61 74 65 20 69 73 20 |rminal s|tate is |
|00004f60| 72 65 61 63 68 20 6f 72 | 20 77 68 65 6e 20 3c 56 |reach or| when <V|
|00004f70| 41 52 3e 6d 61 78 5f 73 | 74 65 70 73 5f 70 65 72 |AR>max_s|teps_per|
|00004f80| 5f 74 72 69 61 6c 3c 2f | 56 41 52 3e 20 73 74 65 |_trial</|VAR> ste|
|00004f90| 70 73 0a 69 73 20 72 65 | 61 63 68 65 64 2c 20 77 |ps.is re|ached, w|
|00004fa0| 68 69 63 68 65 76 65 72 | 20 63 6f 6d 65 73 20 66 |hichever| comes f|
|00004fb0| 69 72 73 74 2e 20 54 68 | 75 73 2c 20 74 68 69 73 |irst. Th|us, this|
|00004fc0| 20 66 75 6e 63 74 69 6f | 6e 20 61 6c 6c 6f 77 73 | functio|n allows|
|00004fd0| 20 74 68 65 20 75 73 65 | 72 0a 74 6f 20 63 6f 6e | the use|r.to con|
|00004fe0| 74 72 6f 6c 20 74 68 65 | 20 65 78 65 63 75 74 69 |trol the| executi|
|00004ff0| 6f 6e 20 6f 66 20 68 65 | 72 20 73 69 6d 75 6c 61 |on of he|r simula|
|00005000| 74 69 6f 6e 20 62 79 20 | 70 72 6f 76 69 64 69 6e |tion by |providin|
|00005010| 67 20 74 68 65 20 74 6f | 74 61 6c 0a 6e 75 6d 62 |g the to|tal.numb|
|00005020| 65 72 20 6f 66 20 74 72 | 69 61 6c 73 20 64 69 72 |er of tr|ials dir|
|00005030| 65 63 74 6c 79 2e 0a 0a | 3c 50 3e 0a 3c 41 20 4e |ectly...|<P>.<A N|
|00005040| 41 4d 45 3d 22 53 69 6d | 75 6c 61 74 69 6f 6e 3a |AME="Sim|ulation:|
|00005050| 3a 63 6f 6c 6c 65 63 74 | 5f 64 61 74 61 22 3e 0a |:collect|_data">.|
|00005060| 3c 44 49 56 20 41 4c 49 | 47 4e 3d 52 49 47 48 54 |<DIV ALI|GN=RIGHT|
|00005070| 3e 0a 5b 3c 41 20 48 52 | 45 46 3d 22 72 6c 69 2e |>.[<A HR|EF="rli.|
|00005080| 63 63 2e 68 74 6d 6c 23 | 53 69 6d 75 6c 61 74 69 |cc.html#|Simulati|
|00005090| 6f 6e 3a 3a 63 6f 6c 6c | 65 63 74 5f 64 61 74 61 |on::coll|ect_data|
|000050a0| 22 3e 76 69 72 74 75 61 | 6c 20 66 75 6e 63 74 69 |">virtua|l functi|
|000050b0| 6f 6e 3c 2f 41 3e 5d 0a | 3c 2f 44 49 56 3e 20 0a |on</A>].|</DIV> .|
|000050c0| 3c 2f 41 3e 0a 3c 54 54 | 3e 0a 76 6f 69 64 20 3c |</A>.<TT|>.void <|
|000050d0| 42 3e 3c 43 4f 44 45 3e | 53 69 6d 75 6c 61 74 69 |B><CODE>|Simulati|
|000050e0| 6f 6e 3a 3a 63 6f 6c 6c | 65 63 74 5f 64 61 74 61 |on::coll|ect_data|
|000050f0| 3c 2f 43 4f 44 45 3e 3c | 2f 42 3e 0a 28 20 63 6f |</CODE><|/B>.( co|
|00005100| 6e 73 74 20 53 65 6e 73 | 61 74 69 6f 6e 2a 20 3c |nst Sens|ation* <|
|00005110| 56 41 52 3e 70 73 3c 2f | 56 41 52 3e 2c 20 63 6f |VAR>ps</|VAR>, co|
|00005120| 6e 73 74 20 41 63 74 69 | 6f 6e 2a 20 3c 56 41 52 |nst Acti|on* <VAR|
|00005130| 3e 70 61 3c 2f 56 41 52 | 3e 2c 20 0a 20 20 63 6f |>pa</VAR|>, . co|
|00005140| 6e 73 74 20 53 65 6e 73 | 61 74 69 6f 6e 2a 20 3c |nst Sens|ation* <|
|00005150| 56 41 52 3e 70 6e 65 78 | 74 5f 73 3c 2f 56 41 52 |VAR>pnex|t_s</VAR|
|00005160| 3e 2c 0a 20 20 64 6f 75 | 62 6c 65 20 3c 56 41 52 |>,. dou|ble <VAR|
|00005170| 3e 72 65 77 61 72 64 3c | 2f 56 41 52 3e 20 29 0a |>reward<|/VAR> ).|
|00005180| 3c 2f 54 54 3e 20 0a 0a | 3c 50 3e 20 54 68 69 73 |</TT> ..|<P> This|
|00005190| 20 66 75 6e 63 74 69 6f | 6e 20 69 73 20 63 61 6c | functio|n is cal|
|000051a0| 6c 65 64 20 6f 6e 63 65 | 20 6f 6e 20 65 61 63 68 |led once| on each|
|000051b0| 20 73 74 65 70 20 6f 66 | 20 74 68 65 20 73 69 6d | step of| the sim|
|000051c0| 75 6c 61 74 69 6f 6e 2e | 20 20 54 68 65 0a 64 65 |ulation.| The.de|
|000051d0| 66 61 75 6c 74 20 6d 65 | 74 68 6f 64 20 64 6f 65 |fault me|thod doe|
|000051e0| 73 20 6e 6f 74 68 69 6e | 67 2c 20 62 75 74 20 75 |s nothin|g, but u|
|000051f0| 73 65 72 2d 64 65 66 69 | 6e 65 64 20 73 70 65 63 |ser-defi|ned spec|
|00005200| 69 61 6c 69 7a 65 64 20 | 6d 65 74 68 6f 64 73 0a |ialized |methods.|
|00005210| 6d 69 67 68 74 20 61 63 | 63 75 6d 75 6c 61 74 65 |might ac|cumulate|
|00005220| 20 72 65 77 61 72 64 73 | 20 6f 72 20 6f 74 68 65 | rewards| or othe|
|00005230| 72 20 64 61 74 61 20 61 | 6e 64 20 75 70 64 61 74 |r data a|nd updat|
|00005240| 65 20 64 69 73 70 6c 61 | 79 73 2e 20 20 54 68 69 |e displa|ys. Thi|
|00005250| 73 20 69 73 0a 74 68 65 | 20 70 72 65 66 65 72 72 |s is.the| preferr|
|00005260| 65 64 20 77 61 79 20 74 | 6f 20 67 61 69 6e 20 61 |ed way t|o gain a|
|00005270| 63 63 65 73 73 20 74 6f | 20 74 68 65 20 73 69 6d |ccess to| the sim|
|00005280| 75 6c 61 74 69 6f 6e 27 | 73 20 62 65 68 61 76 69 |ulation'|s behavi|
|00005290| 6f 72 2e 0a 0a 0a 3c 48 | 52 3e 0a 0a 3c 41 20 4e |or....<H|R>..<A N|
|000052a0| 41 4d 45 3d 22 63 72 6f | 73 73 2d 72 65 66 65 72 |AME="cro|ss-refer|
|000052b0| 65 6e 63 65 22 3e 0a 3c | 48 32 3e 20 41 63 63 65 |ence">.<|H2> Acce|
|000052c0| 73 73 69 6e 67 20 6f 6e | 65 20 6f 62 6a 65 63 74 |ssing on|e object|
|000052d0| 20 66 72 6f 6d 20 61 6e | 6f 74 68 65 72 20 3c 2f | from an|other </|
|000052e0| 48 32 3e 0a 3c 2f 41 3e | 0a 0a 3c 50 3e 20 54 68 |H2>.</A>|..<P> Th|
|000052f0| 65 20 73 69 6d 75 6c 61 | 74 69 6f 6e 20 63 6c 61 |e simula|tion cla|
|00005300| 73 73 20 68 6f 6c 64 73 | 20 74 68 65 20 76 61 6c |ss holds| the val|
|00005310| 75 65 73 20 6f 66 20 74 | 68 65 20 70 6f 69 6e 74 |ues of t|he point|
|00005320| 65 72 73 20 74 6f 20 74 | 68 65 20 61 67 65 6e 74 |ers to t|he agent|
|00005330| 0a 61 6e 64 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 |.and env|ironment|
|00005340| 20 69 6e 73 74 61 6e 63 | 65 73 2e 20 54 68 69 73 | instanc|es. This|
|00005350| 20 66 61 63 69 6c 69 74 | 61 74 65 73 20 63 72 6f | facilit|ates cro|
|00005360| 73 73 2d 72 65 66 65 72 | 65 6e 63 65 73 20 6f 66 |ss-refer|ences of|
|00005370| 0a 69 6e 73 74 61 6e 63 | 65 73 20 69 6e 20 63 61 |.instanc|es in ca|
|00005380| 73 65 20 69 74 20 69 73 | 20 6e 65 65 64 2e 0a 0a |se it is| need...|
|00005390| 3c 50 52 45 3e 0a 63 6c | 61 73 73 20 3c 43 4f 44 |<PRE>.cl|ass <COD|
|000053a0| 45 3e 53 69 6d 75 6c 61 | 74 69 6f 6e 3c 2f 43 4f |E>Simula|tion</CO|
|000053b0| 44 45 3e 20 7b 0a 70 75 | 62 6c 69 63 3a 0a 20 20 |DE> {.pu|blic:. |
|000053c0| 20 41 67 65 6e 74 20 20 | 20 20 20 20 20 2a 3c 56 | Agent | *<V|
|000053d0| 41 52 3e 70 61 67 74 3c | 2f 56 41 52 3e 3b 20 3c |AR>pagt<|/VAR>; <|
|000053e0| 49 3e 20 2f 2f 20 70 6f | 69 6e 74 65 72 20 74 6f |I> // po|inter to|
|000053f0| 20 74 68 65 20 61 67 65 | 6e 74 20 69 6e 73 74 61 | the age|nt insta|
|00005400| 6e 63 65 3c 2f 49 3e 0a | 20 20 20 45 6e 76 69 72 |nce</I>.| Envir|
|00005410| 6f 6e 6d 65 6e 74 20 2a | 3c 56 41 52 3e 70 65 6e |onment *|<VAR>pen|
|00005420| 76 3c 2f 56 41 52 3e 3b | 20 3c 49 3e 20 2f 2f 20 |v</VAR>;| <I> // |
|00005430| 70 6f 69 6e 74 65 72 20 | 74 6f 20 74 68 65 20 65 |pointer |to the e|
|00005440| 6e 76 69 72 6f 6e 6d 65 | 6e 74 20 69 6e 73 74 61 |nvironme|nt insta|
|00005450| 6e 63 65 3c 2f 49 3e 0a | 0a 3c 49 3e 20 20 20 2e |nce</I>.|.<I> .|
|00005460| 3c 2f 49 3e 0a 3c 49 3e | 20 20 20 2e 3c 2f 49 3e |</I>.<I>| .</I>|
|00005470| 0a 3c 49 3e 20 20 20 2e | 3c 2f 49 3e 0a 7d 3b 0a |.<I> .|</I>.};.|
|00005480| 0a 3c 2f 50 52 45 3e 0a | 0a 3c 50 3e 20 53 69 6d |.</PRE>.|.<P> Sim|
|00005490| 69 6c 61 72 6c 79 2c 20 | 69 6e 73 74 61 6e 63 65 |ilarly, |instance|
|000054a0| 73 20 6f 66 20 74 68 65 | 20 61 67 65 6e 74 20 61 |s of the| agent a|
|000054b0| 6e 64 20 65 6e 76 69 72 | 6f 6e 6d 65 6e 74 20 63 |nd envir|onment c|
|000054c0| 6c 61 73 73 65 73 20 68 | 6f 6c 64 0a 70 6f 69 6e |lasses h|old.poin|
|000054d0| 74 65 72 73 20 62 61 63 | 6b 20 74 6f 20 74 68 65 |ters bac|k to the|
|000054e0| 20 73 69 6d 75 6c 61 74 | 69 6f 6e 20 69 6e 73 74 | simulat|ion inst|
|000054f0| 61 6e 63 65 20 74 68 61 | 74 20 69 73 20 75 73 69 |ance tha|t is usi|
|00005500| 6e 67 20 74 68 65 6d 2e | 20 54 68 75 73 2c 20 74 |ng them.| Thus, t|
|00005510| 68 65 0a 69 6e 73 74 61 | 6e 63 65 20 6f 66 20 61 |he.insta|nce of a|
|00005520| 6e 20 61 67 65 6e 74 20 | 63 61 6e 20 72 65 66 65 |n agent |can refe|
|00005530| 72 65 6e 63 65 20 74 68 | 65 20 69 6e 73 74 61 6e |rence th|e instan|
|00005540| 63 65 20 6f 66 20 74 68 | 65 20 65 6e 76 69 72 6f |ce of th|e enviro|
|00005550| 6e 6d 65 6e 74 20 69 74 | 0a 69 73 20 77 6f 72 6b |nment it|.is work|
|00005560| 69 6e 67 20 77 69 74 68 | 20 61 6e 64 20 76 69 63 |ing with| and vic|
|00005570| 65 76 65 72 73 61 20 74 | 68 72 6f 75 67 68 20 74 |eversa t|hrough t|
|00005580| 68 65 20 73 69 6d 75 6c | 61 74 6f 72 20 70 6f 69 |he simul|ator poi|
|00005590| 6e 74 65 72 2e 0a 0a 3c | 50 52 45 3e 0a 63 6c 61 |nter...<|PRE>.cla|
|000055a0| 73 73 20 3c 43 4f 44 45 | 3e 41 67 65 6e 74 3c 2f |ss <CODE|>Agent</|
|000055b0| 43 4f 44 45 3e 20 7b 0a | 70 75 62 6c 69 63 3a 0a |CODE> {.|public:.|
|000055c0| 20 20 20 53 69 6d 75 6c | 61 74 69 6f 6e 20 20 2a | Simul|ation *|
|000055d0| 3c 56 41 52 3e 70 73 69 | 6d 3c 2f 56 41 52 3e 3b |<VAR>psi|m</VAR>;|
|000055e0| 20 3c 49 3e 20 2f 2f 20 | 70 6f 69 6e 74 65 72 20 | <I> // |pointer |
|000055f0| 74 6f 20 74 68 65 20 73 | 69 6d 75 6c 61 74 69 6f |to the s|imulatio|
|00005600| 6e 20 69 6e 73 74 61 6e | 63 65 3c 2f 49 3e 0a 0a |n instan|ce</I>..|
|00005610| 3c 49 3e 20 20 20 2e 3c | 2f 49 3e 0a 3c 49 3e 20 |<I> .<|/I>.<I> |
|00005620| 20 20 2e 3c 2f 49 3e 0a | 3c 49 3e 20 20 20 2e 3c | .</I>.|<I> .<|
|00005630| 2f 49 3e 0a 7d 3b 0a 0a | 63 6c 61 73 73 20 3c 43 |/I>.};..|class <C|
|00005640| 4f 44 45 3e 45 6e 76 69 | 72 6f 6e 6d 65 6e 74 3c |ODE>Envi|ronment<|
|00005650| 2f 43 4f 44 45 3e 20 7b | 0a 70 75 62 6c 69 63 3a |/CODE> {|.public:|
|00005660| 0a 20 20 20 53 69 6d 75 | 6c 61 74 69 6f 6e 20 20 |. Simu|lation |
|00005670| 2a 3c 56 41 52 3e 70 73 | 69 6d 3c 2f 56 41 52 3e |*<VAR>ps|im</VAR>|
|00005680| 3b 20 3c 49 3e 20 2f 2f | 20 70 6f 69 6e 74 65 72 |; <I> //| pointer|
|00005690| 20 74 6f 20 74 68 65 20 | 73 69 6d 75 6c 61 74 69 | to the |simulati|
|000056a0| 6f 6e 20 69 6e 73 74 61 | 6e 63 65 3c 2f 49 3e 0a |on insta|nce</I>.|
|000056b0| 0a 3c 49 3e 20 20 20 2e | 3c 2f 49 3e 0a 3c 49 3e |.<I> .|</I>.<I>|
|000056c0| 20 20 20 2e 3c 2f 49 3e | 0a 3c 49 3e 20 20 20 2e | .</I>|.<I> .|
|000056d0| 3c 2f 49 3e 0a 7d 3b 0a | 0a 0a 2f 2f 20 45 78 61 |</I>.};.|..// Exa|
|000056e0| 6d 70 6c 65 0a 0a 7b 0a | 20 20 20 4d 79 5f 41 67 |mple..{.| My_Ag|
|000056f0| 65 6e 74 20 20 20 20 20 | 20 20 2a 70 61 67 74 3b |ent | *pagt;|
|00005700| 0a 20 20 20 4d 79 5f 45 | 6e 76 69 72 6f 6e 6d 65 |. My_E|nvironme|
|00005710| 6e 74 20 2a 70 65 6e 76 | 3b 0a 0a 20 20 20 70 61 |nt *penv|;.. pa|
|00005720| 67 74 2d 3e 70 73 69 6d | 3b 20 20 20 20 20 20 20 |gt->psim|; |
|00005730| 20 20 20 2f 2f 20 61 63 | 63 65 73 73 69 6e 67 20 | // ac|cessing |
|00005740| 74 68 65 20 73 69 6d 75 | 6c 61 74 69 6f 6e 20 66 |the simu|lation f|
|00005750| 72 6f 6d 20 74 68 65 20 | 61 67 65 6e 74 0a 20 20 |rom the |agent. |
|00005760| 20 70 65 6e 76 2d 3e 70 | 73 69 6d 3b 20 20 20 20 | penv->p|sim; |
|00005770| 20 20 20 20 20 20 2f 2f | 20 61 63 63 65 73 73 69 | //| accessi|
|00005780| 6e 67 20 74 68 65 20 73 | 69 6d 75 6c 61 74 69 6f |ng the s|imulatio|
|00005790| 6e 20 66 72 6f 6d 20 74 | 68 65 20 65 6e 76 69 72 |n from t|he envir|
|000057a0| 6f 6e 6d 65 6e 74 0a 0a | 20 20 20 70 61 67 74 2d |onment..| pagt-|
|000057b0| 3e 70 73 69 6d 2d 3e 70 | 65 6e 76 3b 20 20 20 20 |>psim->p|env; |
|000057c0| 2f 2f 20 61 63 63 65 73 | 73 69 6e 67 20 74 68 65 |// acces|sing the|
|000057d0| 20 65 6e 76 69 72 6f 6e | 6d 65 6e 74 20 66 72 6f | environ|ment fro|
|000057e0| 6d 20 74 68 65 20 61 67 | 65 6e 74 0a 20 20 20 70 |m the ag|ent. p|
|000057f0| 65 6e 76 2d 3e 70 73 69 | 6d 2d 3e 70 61 67 74 3b |env->psi|m->pagt;|
|00005800| 20 20 20 20 2f 2f 20 61 | 63 63 65 73 73 69 6e 67 | // a|ccessing|
|00005810| 20 74 68 65 20 61 67 65 | 6e 74 20 66 72 6f 6d 20 | the age|nt from |
|00005820| 74 68 65 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 0a |the envi|ronment.|
|00005830| 7d 0a 0a 3c 2f 50 52 45 | 3e 0a 0a 0a 3c 48 52 3e |}..</PRE|>...<HR>|
|00005840| 0a 0a 3c 41 20 4e 41 4d | 45 3d 22 64 6f 75 62 6c |..<A NAM|E="doubl|
|00005850| 65 2d 69 6e 74 65 67 72 | 61 74 6f 72 22 3e 0a 3c |e-integr|ator">.<|
|00005860| 48 32 3e 20 41 20 63 6f | 6d 70 6c 65 74 65 20 65 |H2> A co|mplete e|
|00005870| 78 61 6d 70 6c 65 3a 20 | 64 6f 75 62 6c 65 2d 69 |xample: |double-i|
|00005880| 6e 74 65 67 72 61 74 6f | 72 20 3c 2f 48 32 3e 0a |ntegrato|r </H2>.|
|00005890| 3c 2f 41 3e 0a 0a 3c 50 | 3e 20 54 68 65 20 66 6f |</A>..<P|> The fo|
|000058a0| 6c 6c 6f 77 69 6e 67 20 | 73 6f 75 72 63 65 20 63 |llowing |source c|
|000058b0| 6f 64 65 20 64 65 6d 6f | 6e 73 74 72 61 74 65 73 |ode demo|nstrates|
|000058c0| 20 74 68 65 20 75 73 65 | 20 6f 66 20 74 68 65 20 | the use| of the |
|000058d0| 69 6e 74 65 72 66 61 63 | 65 20 69 6e 0a 61 20 64 |interfac|e in.a d|
|000058e0| 6f 75 62 6c 65 2d 69 6e | 74 65 67 72 61 74 6f 72 |ouble-in|tegrator|
|000058f0| 2c 20 77 68 69 63 68 20 | 69 73 20 61 20 6c 69 6e |, which |is a lin|
|00005900| 65 61 72 20 64 79 6e 61 | 6d 69 63 61 6c 20 73 79 |ear dyna|mical sy|
|00005910| 73 74 65 6d 20 77 69 74 | 68 20 61 0a 62 69 64 69 |stem wit|h a.bidi|
|00005920| 6d 65 6e 73 69 6f 6e 61 | 6c 20 63 6f 6e 74 69 6e |mensiona|l contin|
|00005930| 75 6f 75 73 20 73 74 61 | 74 65 2e 20 20 54 68 65 |uous sta|te. The|
|00005940| 20 6f 70 74 69 6d 61 6c | 20 61 67 65 6e 74 20 69 | optimal| agent i|
|00005950| 6d 70 6c 65 6d 65 6e 74 | 73 20 74 68 65 0a 6f 70 |mplement|s the.op|
|00005960| 74 69 6d 61 6c 20 70 6f | 6c 69 63 79 20 66 6f 72 |timal po|licy for|
|00005970| 20 73 6f 6c 76 69 6e 67 | 20 74 68 65 20 70 72 6f | solving| the pro|
|00005980| 62 6c 65 6d 2e 20 54 68 | 65 20 43 4d 41 43 20 61 |blem. Th|e CMAC a|
|00005990| 67 65 6e 74 20 61 70 70 | 72 6f 78 69 6d 61 74 65 |gent app|roximate|
|000059a0| 73 0a 74 68 65 20 51 2d | 66 75 6e 63 74 69 6f 6e |s.the Q-|function|
|000059b0| 20 77 69 74 68 20 61 20 | 43 4d 41 43 20 61 6e 64 | with a |CMAC and|
|000059c0| 20 75 73 65 73 20 53 41 | 52 53 41 20 61 73 20 74 | uses SA|RSA as t|
|000059d0| 68 65 20 6c 65 61 72 6e | 69 6e 67 0a 61 6c 67 6f |he learn|ing.algo|
|000059e0| 72 69 74 68 6d 2e 20 54 | 68 65 20 73 6f 75 72 63 |rithm. T|he sourc|
|000059f0| 65 20 63 6f 64 65 20 69 | 73 20 64 69 76 69 64 65 |e code i|s divide|
|00005a00| 64 20 69 6e 74 6f 20 73 | 65 76 65 72 61 6c 20 6d |d into s|everal m|
|00005a10| 6f 64 75 6c 65 73 2e 20 | 41 73 20 69 74 20 69 73 |odules. |As it is|
|00005a20| 0a 74 72 61 64 69 74 69 | 6f 6e 61 6c 20 69 6e 20 |.traditi|onal in |
|00005a30| 3c 42 3e 43 2b 2b 3c 2f | 42 3e 2c 20 65 61 63 68 |<B>C++</|B>, each|
|00005a40| 20 6d 6f 64 75 6c 65 20 | 6e 61 6d 65 64 20 3c 54 | module |named <T|
|00005a50| 54 3e 78 78 78 3c 2f 54 | 54 3e 20 68 61 73 20 61 |T>xxx</T|T> has a|
|00005a60| 6e 0a 69 6e 74 65 72 66 | 61 63 65 20 66 69 6c 65 |n.interf|ace file|
|00005a70| 20 28 69 2e 65 2e 2c 20 | 3c 54 54 3e 78 78 78 2e | (i.e., |<TT>xxx.|
|00005a80| 68 3c 2f 54 54 3e 29 20 | 61 6e 64 20 61 6e 20 69 |h</TT>) |and an i|
|00005a90| 6d 70 6c 65 6d 65 6e 74 | 61 74 69 6f 6e 20 66 69 |mplement|ation fi|
|00005aa0| 6c 65 0a 3c 54 54 3e 78 | 78 78 2e 63 63 3c 2f 54 |le.<TT>x|xx.cc</T|
|00005ab0| 54 3e 2e 20 54 68 65 20 | 65 78 61 6d 70 6c 65 20 |T>. The |example |
|00005ac0| 69 6e 63 6c 75 64 65 73 | 20 74 77 6f 20 64 69 66 |includes| two dif|
|00005ad0| 66 65 72 65 6e 74 20 61 | 67 65 6e 74 73 3a 20 6f |ferent a|gents: o|
|00005ae0| 70 74 69 6d 61 6c 0a 61 | 6e 64 20 43 4d 41 43 2e |ptimal.a|nd CMAC.|
|00005af0| 20 54 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 6c | The fol|lowing l|
|00005b00| 69 73 74 20 70 72 6f 76 | 69 64 65 73 20 61 20 62 |ist prov|ides a b|
|00005b10| 72 69 65 66 20 64 65 73 | 63 72 69 70 74 69 6f 6e |rief des|cription|
|00005b20| 20 6f 66 20 65 61 63 68 | 0a 6d 6f 64 75 6c 65 2e | of each|.module.|
|00005b30| 20 54 68 65 20 63 6f 64 | 65 20 63 6f 6d 70 69 6c | The cod|e compil|
|00005b40| 65 73 20 61 6e 64 20 72 | 75 6e 73 20 69 6e 20 55 |es and r|uns in U|
|00005b50| 4e 49 58 20 75 73 69 6e | 67 20 74 68 65 20 47 4e |NIX usin|g the GN|
|00005b60| 55 20 43 2b 2b 20 63 6f | 6d 70 69 6c 65 72 0a 28 |U C++ co|mpiler.(|
|00005b70| 3c 42 3e 67 2b 2b 3c 2f | 42 3e 29 2e 0a 0a 3c 4d |<B>g++</|B>)...<M|
|00005b80| 45 4e 55 3e 0a 0a 3c 4c | 49 3e 20 3c 54 54 3e 72 |ENU>..<L|I> <TT>r|
|00005b90| 6c 69 3c 2f 54 54 3e 20 | 28 3c 41 20 48 52 45 46 |li</TT> |(<A HREF|
|00005ba0| 3d 22 72 6c 69 2e 68 2e | 68 74 6d 6c 22 3e 3c 54 |="rli.h.|html"><T|
|00005bb0| 54 3e 72 6c 69 2e 68 3c | 2f 54 54 3e 3c 2f 41 3e |T>rli.h<|/TT></A>|
|00005bc0| 2c 20 0a 20 20 20 20 20 | 3c 41 20 48 52 45 46 3d |, . |<A HREF=|
|00005bd0| 22 72 6c 69 2e 63 63 2e | 68 74 6d 6c 22 3e 3c 54 |"rli.cc.|html"><T|
|00005be0| 54 3e 72 6c 69 2e 63 63 | 3c 2f 54 54 3e 3c 2f 41 |T>rli.cc|</TT></A|
|00005bf0| 3e 29 3a 20 54 68 69 73 | 20 6d 6f 64 75 6c 65 20 |>): This| module |
|00005c00| 64 65 66 69 6e 65 73 0a | 20 20 20 20 20 61 6c 6c |defines.| all|
|00005c10| 20 74 68 65 20 61 62 73 | 74 72 61 63 74 20 63 6c | the abs|tract cl|
|00005c20| 61 73 73 65 73 20 61 6e | 64 20 66 75 6e 63 74 69 |asses an|d functi|
|00005c30| 6f 6e 73 20 6f 66 20 74 | 68 65 20 72 65 69 6e 66 |ons of t|he reinf|
|00005c40| 6f 72 63 65 6d 65 6e 74 | 20 6c 65 61 72 6e 69 6e |orcement| learnin|
|00005c50| 67 0a 20 20 20 20 20 69 | 6e 74 65 72 66 61 63 65 |g. i|nterface|
|00005c60| 2e 0a 0a 3c 4c 49 3e 20 | 3c 54 54 3e 65 6e 76 69 |...<LI> |<TT>envi|
|00005c70| 72 6f 6e 6d 65 6e 74 2d | 64 62 69 3c 2f 54 54 3e |ronment-|dbi</TT>|
|00005c80| 20 28 3c 41 20 48 52 45 | 46 3d 22 65 6e 76 69 72 | (<A HRE|F="envir|
|00005c90| 6f 6e 6d 65 6e 74 2d 64 | 62 69 2e 68 2e 68 74 6d |onment-d|bi.h.htm|
|00005ca0| 6c 22 3e 3c 54 54 3e 65 | 6e 76 69 72 6f 6d 65 6e |l"><TT>e|nviromen|
|00005cb0| 74 2d 64 62 69 2e 68 3c | 2f 54 54 3e 3c 2f 41 3e |t-dbi.h<|/TT></A>|
|00005cc0| 2c 20 0a 20 20 20 20 20 | 3c 41 20 48 52 45 46 3d |, . |<A HREF=|
|00005cd0| 22 65 6e 76 69 72 6f 6e | 6d 65 6e 74 2d 64 62 69 |"environ|ment-dbi|
|00005ce0| 2e 63 63 2e 68 74 6d 6c | 22 3e 3c 54 54 3e 65 6e |.cc.html|"><TT>en|
|00005cf0| 76 69 72 6f 6e 6d 65 6e | 74 2d 64 62 69 2e 63 63 |vironmen|t-dbi.cc|
|00005d00| 3c 2f 54 54 3e 3c 2f 41 | 3e 29 3a 20 54 68 69 73 |</TT></A|>): This|
|00005d10| 20 6d 6f 64 75 6c 65 20 | 64 65 66 69 6e 65 73 0a | module |defines.|
|00005d20| 20 20 20 20 20 74 68 65 | 20 64 6f 75 62 6c 65 2d | the| double-|
|00005d30| 69 6e 74 65 67 72 61 74 | 6f 72 20 65 6e 76 69 72 |integrat|or envir|
|00005d40| 6f 6e 6d 65 6e 74 2e 0a | 0a 3c 4c 49 3e 20 3c 54 |onment..|.<LI> <T|
|00005d50| 54 3e 61 67 65 6e 74 2d | 6f 70 74 69 6d 61 6c 2d |T>agent-|optimal-|
|00005d60| 64 62 69 3c 2f 54 54 3e | 20 28 3c 41 20 48 52 45 |dbi</TT>| (<A HRE|
|00005d70| 46 3d 22 61 67 65 6e 74 | 2d 6f 70 74 69 6d 61 6c |F="agent|-optimal|
|00005d80| 2d 64 62 69 2e 68 2e 68 | 74 6d 6c 22 3e 0a 20 20 |-dbi.h.h|tml">. |
|00005d90| 20 20 20 3c 54 54 3e 61 | 67 65 6e 74 2d 6f 70 74 | <TT>a|gent-opt|
|00005da0| 69 6d 61 6c 2d 64 62 69 | 2e 68 3c 2f 54 54 3e 3c |imal-dbi|.h</TT><|
|00005db0| 2f 41 3e 2c 20 3c 41 20 | 48 52 45 46 3d 22 61 67 |/A>, <A |HREF="ag|
|00005dc0| 65 6e 74 2d 6f 70 74 69 | 6d 61 6c 2d 64 62 69 2e |ent-opti|mal-dbi.|
|00005dd0| 63 63 2e 68 74 6d 6c 22 | 3e 0a 20 20 20 20 20 3c |cc.html"|>. <|
|00005de0| 54 54 3e 61 67 65 6e 74 | 2d 6f 70 74 69 6d 61 6c |TT>agent|-optimal|
|00005df0| 2d 64 62 69 2e 63 63 3c | 2f 54 54 3e 3c 2f 41 3e |-dbi.cc<|/TT></A>|
|00005e00| 29 3a 20 54 68 69 73 20 | 6d 6f 64 75 6c 65 20 64 |): This |module d|
|00005e10| 65 66 69 6e 65 73 0a 20 | 20 20 20 20 74 68 65 20 |efines. | the |
|00005e20| 6f 70 74 69 6d 61 6c 20 | 61 67 65 6e 74 20 66 6f |optimal |agent fo|
|00005e30| 72 20 74 68 65 20 64 6f | 75 62 6c 65 2d 69 6e 74 |r the do|uble-int|
|00005e40| 65 67 72 61 74 6f 72 20 | 65 6e 76 69 72 6f 6e 6d |egrator |environm|
|00005e50| 65 6e 74 2e 0a 0a 3c 4c | 49 3e 20 3c 54 54 3e 61 |ent...<L|I> <TT>a|
|00005e60| 67 65 6e 74 2d 63 6d 61 | 63 2d 64 62 69 3c 2f 54 |gent-cma|c-dbi</T|
|00005e70| 54 3e 20 0a 20 20 20 20 | 20 28 3c 41 20 48 52 45 |T> . | (<A HRE|
|00005e80| 46 3d 22 61 67 65 6e 74 | 2d 63 6d 61 63 2d 64 62 |F="agent|-cmac-db|
|00005e90| 69 2e 68 2e 68 74 6d 6c | 22 3e 3c 54 54 3e 61 67 |i.h.html|"><TT>ag|
|00005ea0| 65 6e 74 2d 63 6d 61 63 | 2d 64 62 69 2e 68 3c 2f |ent-cmac|-dbi.h</|
|00005eb0| 54 54 3e 3c 2f 41 3e 2c | 0a 20 20 20 20 20 3c 41 |TT></A>,|. <A|
|00005ec0| 20 48 52 45 46 3d 22 61 | 67 65 6e 74 2d 63 6d 61 | HREF="a|gent-cma|
|00005ed0| 63 2d 64 62 69 2e 63 63 | 2e 68 74 6d 6c 22 3e 3c |c-dbi.cc|.html"><|
|00005ee0| 54 54 3e 61 67 65 6e 74 | 2d 63 6d 61 63 2d 64 62 |TT>agent|-cmac-db|
|00005ef0| 69 2e 63 63 3c 2f 54 54 | 3e 3c 2f 41 3e 29 3a 20 |i.cc</TT|></A>): |
|00005f00| 0a 20 20 20 20 20 54 68 | 69 73 20 6d 6f 64 75 6c |. Th|is modul|
|00005f10| 65 20 64 65 66 69 6e 65 | 73 20 74 68 65 20 6c 65 |e define|s the le|
|00005f20| 61 72 6e 69 6e 67 20 61 | 67 65 6e 74 20 74 68 61 |arning a|gent tha|
|00005f30| 74 20 75 73 65 73 20 43 | 4d 41 43 73 20 74 6f 20 |t uses C|MACs to |
|00005f40| 73 6f 6c 76 65 20 74 68 | 65 20 0a 20 20 20 20 20 |solve th|e . |
|00005f50| 64 6f 75 62 6c 65 2d 69 | 6e 74 65 67 72 61 74 6f |double-i|ntegrato|
|00005f60| 72 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 2e 0a 0a |r enviro|nment...|
|00005f70| 3c 4c 49 3e 20 3c 41 20 | 48 52 45 46 3d 22 6d 61 |<LI> <A |HREF="ma|
|00005f80| 69 6e 2d 64 62 69 2e 63 | 63 2e 68 74 6d 6c 22 3e |in-dbi.c|c.html">|
|00005f90| 3c 54 54 3e 6d 61 69 6e | 2d 64 62 69 2e 63 63 3c |<TT>main|-dbi.cc<|
|00005fa0| 2f 54 54 3e 3c 2f 41 3e | 3a 20 54 68 69 73 20 6d |/TT></A>|: This m|
|00005fb0| 6f 64 75 6c 65 0a 20 20 | 20 20 20 64 65 66 69 6e |odule. | defin|
|00005fc0| 65 73 20 74 77 6f 20 74 | 79 70 65 73 20 6f 66 20 |es two t|ypes of |
|00005fd0| 73 69 6d 75 6c 61 74 69 | 6f 6e 20 6f 62 6a 65 63 |simulati|on objec|
|00005fe0| 74 73 20 61 6e 64 20 63 | 6f 6e 74 61 69 6e 73 20 |ts and c|ontains |
|00005ff0| 74 68 65 20 6d 61 69 6e | 20 70 72 6f 67 72 61 6d |the main| program|
|00006000| 0a 20 20 20 20 20 74 68 | 61 74 20 65 78 65 63 75 |. th|at execu|
|00006010| 74 65 73 20 74 68 65 20 | 73 69 6d 75 6c 61 74 69 |tes the |simulati|
|00006020| 6f 6e 2e 0a 0a 3c 2f 4d | 45 4e 55 3e 0a 0a 41 6c |on...</M|ENU>..Al|
|00006030| 6c 20 74 68 65 20 73 6f | 75 72 63 65 20 63 6f 64 |l the so|urce cod|
|00006040| 65 2c 20 69 6e 63 6c 75 | 64 69 6e 67 20 74 68 65 |e, inclu|ding the|
|00006050| 20 52 4c 20 69 6e 74 65 | 72 66 61 63 65 2c 20 64 | RL inte|rface, d|
|00006060| 6f 75 62 6c 65 2d 69 6e | 74 65 67 72 61 74 6f 72 |ouble-in|tegrator|
|00006070| 2c 0a 61 67 65 6e 74 73 | 2c 20 74 68 65 20 6d 61 |,.agents|, the ma|
|00006080| 6b 65 66 69 6c 65 2c 20 | 61 6e 64 20 52 45 41 44 |kefile, |and READ|
|00006090| 4d 45 20 69 73 20 73 74 | 6f 72 65 64 20 69 6e 20 |ME is st|ored in |
|000060a0| 61 20 74 61 72 20 66 69 | 6c 65 20 3c 41 0a 48 52 |a tar fi|le <A.HR|
|000060b0| 45 46 3d 22 66 74 70 3a | 2f 2f 66 74 70 2e 63 63 |EF="ftp:|//ftp.cc|
|000060c0| 2e 67 61 74 65 63 68 2e | 65 64 75 2f 70 75 62 2f |.gatech.|edu/pub/|
|000060d0| 61 69 2f 73 74 75 64 65 | 6e 74 73 2f 63 61 72 6c |ai/stude|nts/carl|
|000060e0| 6f 73 2f 52 4c 49 2f 65 | 78 61 6d 70 6c 65 2e 74 |os/RLI/e|xample.t|
|000060f0| 61 72 22 3e 68 65 72 65 | 3c 2f 41 3e 2e 0a 0a 3c |ar">here|</A>...<|
|00006100| 50 52 45 3e 0a 0a 0a 0a | 0a 0a 0a 0a 0a 0a 0a 0a |PRE>....|........|
|00006110| 0a 3c 2f 50 52 45 3e 0a | 0a 3c 2f 42 4f 44 59 3e |.</PRE>.|.</BODY>|
|00006120| 20 0a 0a 3c 2f 48 54 4d | 4c 3e 0a 0a 0a 0a 00 00 | ..</HTM|L>......|
|00006130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006180| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006190| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000061a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000061b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000061c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000061d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000061e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000061f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006200| 64 6f 63 75 6d 65 6e 74 | 61 74 69 6f 6e 2f 61 67 |document|ation/ag|
|00006210| 65 6e 74 2d 63 6d 61 63 | 2d 64 62 69 2e 63 63 2e |ent-cmac|-dbi.cc.|
|00006220| 68 74 6d 6c 00 00 00 00 | 00 00 00 00 00 00 00 00 |html....|........|
|00006230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006260| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 34 32 31 |.... 6|44 . 421|
|00006270| 30 37 20 00 20 20 33 30 | 34 37 20 00 20 20 20 20 |07 . 30|47 . |
|00006280| 20 20 32 36 32 34 32 20 | 20 36 32 32 30 35 32 30 | 26242 | 6220520|
|00006290| 33 30 33 20 20 31 37 31 | 33 32 00 20 30 00 00 00 |303 171|32. 0...|
|000062a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000062b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000062c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000062d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000062e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000062f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006300| 00 75 73 74 61 72 20 20 | 00 63 61 72 6c 6f 73 00 |.ustar |.carlos.|
|00006310| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006320| 00 00 00 00 00 00 00 00 | 00 75 61 73 74 61 66 66 |........|.uastaff|
|00006330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006390| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000063a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000063b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000063c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000063d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000063e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000063f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.